I have a Linux system with several users. I don't know their passwords, nor do I want to know them.
I have to do a batch copy of some of their directories over SSH, with their account and password.
My idea was to make a backup of /etc/shadow
, then alter it with new passwords for each user (one that I know, like "tmppass"), do my backups, then replace the /etc/shadow
file with the old one.
Will that work? If so, how do I generate the password/s? (The passwords are like $1$xxxxxx/xxxxx).
Best Answer
Just backup the
/etc/shadow
file, and change the users passwords withpasswd
:Backup the shadow file:
Change the password of the user you want to access (e.g.
testuser
):When done, restore the /etc/shadow file from the backup:
Note that all passwords should be reset to the passwords they were when they were backed up.
Works on Fedora 19
N.B. Not what you asked, but it would be much easier to access those users with:
This only require authentication with sudo, not as that user.