[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [K12OSN] changing passwords for multiple users
- From: Petre Scheie <petre maltzen net>
- To: k12osn redhat com
- Subject: Re: [K12OSN] changing passwords for multiple users
- Date: Mon Nov 3 16:13:01 2003
I wrote something a few years ago to do this, using expect which is part
of tcl/tk. Here the expect script:
#!/usr/bin/expect -f
#
# chpw.exp: Sets default password for new accounts.
set pw [lindex $argv 1]
set id [lindex $argv 0]
spawn passwd $id
match_max 100000
expect -exact "Enter choice here: "
send -- "p\r"
expect -exact "New password: "
send -- "$pw\r"
expect -exact "Re-enter new password: "
send -- "$pw\r"
expect eof
Put the above in a file, and then call it with the userid and new
password as the parameters, and it will change the user's password.
Then you can just do
for x in `cat id_and_pw.txt`
do
./chpw.exp $x
done
where ic_and_pw.txt is a file that contains a series of rows with each
row having an ID and its respective new password.
HTH
Petre
Tom Kovalcik wrote:
I thought I saw this somewhere but cannot find it. Does anyone have a
script for changing the passwords of many users? Ideally it would take a
text file with username and password and do the deed for every listing
in the file. The important part is that I do not want to delete the
users and recreate since the home directories already exist and have
data in them.
Thanks for the help.
Tom Kovalcik
Orion Design Technologies
122 Mast Road
Lee, NH 03824
Phone: (603) 659-9800 x104
FAX: (603) 659-9870
kovalcik orion-design com
Web site: http://www.orion-design.com
_______________________________________________
K12OSN mailing list
K12OSN redhat com
https://www.redhat.com/mailman/listinfo/k12osn
For more info see <http://www.k12os.org>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]