Passmass - Changing your password on many machines simultaneously

Don Libes
libes@nist.gov

Passmass is an Expect script that can change your password on multiple machines simultaneously. Why is this good? If you are like me, you've got accounts on a dozen or so hosts across the Internet. (I know people with accounts on over a hundred hosts!)

You don't have a problem if all your accounts are on machines that share a common password file. In this case, you can run /bin/passwd once and all the machines learn your new password. But more typically, you will have accounts on machines in many different domains that don't share passwords.

In that case, you have to update each machine by hand. If you want to keep the same password on all your accounts, you must laboriously log in to every one of the hosts. An alternative is to keep different passwords on every host, but that requires a phenomenal memory - or writing them down somewhere. All of the machines I use force me to change passwords regularly, making this a regular pain.

The passmass script offers a way out of this mess. Passmass will log into each host for you, changing your password appropriately. It's very easy to use. You just call it with a list of hosts. For example:

passmass uunet.uu.net nic.switch.ch nic.funet.fi ...

When Passmass runs, it asks you for the old and new passwords. Passmass then goes off to all the hosts and changes your password for you.

Remembering the hosts is not a problem. If you have a long list of hosts, just put the command in a one-line shell script or alias. Then, whenever you get a new account on a new machine, add the appropriate arguments to the command and run it whenever you want to change your passwords on all the hosts.

Passmass understands the "usual" conventions. Flags may be used for fine tuning. They affect all hosts which follow until another flag overrides them. For example, if I am known as "libes" on host1, but "don" on host2 and host3, I could say:

passmass -user libes host1 -user don host2 host3

Some of the other flags are shown below. (The man page lists them all.)

-rlogin Use rlogin to access host. (default)
-telnet Use telnet to access host.
-program Next argument is program to run to set password. Default is passwd. Other common choices are yppasswd and set passwd (e.g., VMS hosts).
-timeout Next argument is number of seconds to wait for responses. Default is 30 but some systems can be much slower logging in.

The Passmass script is a classic Expect-style solution. If you look at the script, you will see that it doesn't diddle with sockets or lock password files or any of that nonportable nonsense. Instead, it merely automates what you do by hand. In this case, Expect uses the same programs that you do and automates two interactions (login and passwd) that normally force you to do the interaction. Any time you face repeated interactions like this, Expect should leap to mind.

Expect is completely described by the book "Exploring Expect" written by its creator, Don Libes. The book is available from O'Reilly (ISBN 1-56592-090-2) but Expect is free and in the public domain. Passmass comes with the Expect software distribution as an example.