|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
script to change userID password
I have a file contain userID's and require to set inital password for all userId's in the file using pwdadm command.
When I run my script it prompt me with enter New password please note pwdadm does not have option such as pwdadm $name $passwd it only works with pwdadm $name then it prompts for entering the new password. What is wrong with my script cat password.txt|while read name do pwdadm $name echo newpaswd123 ###Assign new password done |
|
#2
|
|||
|
|||
|
try read a good shell book first ?
|
|
#3
|
|||
|
|||
|
Yes Thank you for advise
Can any one help |
|
#4
|
|||
|
|||
|
if so, you sure realized:
a) while read name = read in $name a string until a blanc is encountered, you don't check the IFS nor the input-strings, this works only (and is an assumption) if pwd.txt contains: userA userB .. userX nota, i prefer the syntax: for name in `cat file` do ... done 2) pwdadm $name i don't know this prog, but i suppose it expect an user-name AND an input (maybe with confirmation) 3) echo newpaswd123 prints on standard-output (also mostly tty) the string new... this is NOT the input of 'pwdadm' 4) in *nix, only the first 8 chars are significant, so newpaswd123 and newpaswd999 ARE the same. ---------------- i see two way to do it 1) install and use 'expect' 2) manually crypt the newpwd, replace the crypted pwd in /etc/[passwd|shadow] or nis-table and hope it works. (using the right tool, a child's play) |
|
#5
|
|||
|
|||
|
expect is available as part of gnu utils. If you don't have expect (a very good solution to your problem) - and I am not familair with pwdadm either because as I remember it's an AIX thing - you need to give us a sample session for one user.
On a lot of systems, sysadmins use passwd to alter passwords for user accounts - I assume you can do that on AIX as well? |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > script to change userID password |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|