|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sometimes it is necessary to make a user's password identical on several hosts in an environment where it doesn't matter if this is discovered, and the same encrypted password field can be used on each of the hosts. The new encrypted password can be generated by 'makekey' (if it exists - usually in somewhere like /usr/lbin), or extracted from a passwd file that has had the new password applied. # where xxxxxxxxxxxxx is the new 13 char encrypted password. awk -v user="$USER" -v pw="$PW" -F: ' Note the use of ':' as the delimiter for the 'ed' 'substitute' command. It will not get confused with the ':'s in the line, and is guaranteed not to exist in either the old or new password strings. This can even be done across hosts provided root has the permission to do so, and can ssh (or remsh) to the other host without entering a password. ssh otherhost cat /etc/passwd | awk -F: ' This can be built into a loop to perform the change on all the required hosts. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||