I currently have 52 Pi's that were installed in a rush for a project. I monitor them remotely using a combination of RDCman and filezilla.

I need to change username and(or at least) password for the Pi user and Root user on all of them. To avoid time wasting and to learn about configuring multiples at once what is the best method to do this? Can I just update a file in filezilla? or is it best to use a script of some sort?

Please let me know if I need to provide more information.

Thanks in advance!!!!

  • if you are likely to need to do this or similar tasks more than once you could look into fabric (which is python based and works over SSH), if your needs extend beyond this and include setting up multiple Pi's with similar settings you can look at one of the config management tools like puppet or ansible, Commented Jun 23, 2016 at 23:17

2 Answers 2


The username and some other information on users is stored in /etc/passwd. Their password and expiry information is stored in /etc/shadow. The format of these files is documented here: http://www.tldp.org/LDP/lame/LAME/linux-admin-made-easy/shadow-file-formats.html

If you were to make the change on one of your devices, you could then transfer these two files to the rest of the devices. You need to be root to write to /etc/passwd and to read or write /etc/shadow, you should take care to keep these permissions across all devices. (otherwise users other than root could 'blank' anyone's password by editing /etc/shadow).


I would have a universal ssh key setup on all machines for root and user that never changes.

(This way if a script or any automation done to change passwords doesn't render your systems unavailable if something breaks, you can still get in.)

Then have a script on each one that takes args for name/passwords.

The "parent" machine would log into each system via ssh key and run those scripts with args.

Like so: ./passwordscript.sh oldpass newpass

For added security in the scripts, you could add a hash or "key" arg that is preloaded in the script.

Have a variable in the beginning with this key.

Example hash check:

if [[ $hash =~ $1 ]]
    (do your password code here)
    echo You are not authorized to access this script.
    exit 0

Example use would then be: ./passwordscript.sh hash oldpass newpass

For details on the scripts see this answer: Changing a linux password via script?

This was not my question or answer, so I can't detail the steps here without plagiarizing other's work. But a good google search can locate how to create a password change script.

But the question/answers do fall out of scope imo for this SE since this is a general unix/linux type question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.