I am setting up a new account on a Linux box for Subversion repository access, and can send the password to the new user. However, I think there was a command line utility for this new user to encrypt the password he likes into a format I can copy/paste directly into the /etc/shadow file.
What was the full command that this new user should run on the console (e.g. Bash) to create such an encrypted password?
UPDATE: the user will not be allowed to log in on the machine, and the account will merely be used for svn+ssh:// access. Therefore, the user cannot change it himself.
the user can execute on his computer something like:
and then send you the output.
The format of the password in shadow can vary. You could set it to be MD5 or the good old DES3 or... You are good sending your user a password and forcing her to change it in the first login (
# chage -d 0 username
)Instead of having them encrypt the password and send it to you, why not just tell them to type:
It will do everything you want with the added advantage that they can change their passwords without any extra work for you.
EDIT: According to this, there's supposedly a command called makepassword that you can get for Debian/Ubuntu.
/etc/passwd and /etc/shadow are very easy to tokenize with the usual command line tools (i.e. grep, awk, sed, tr, etc).
What becomes interesting is the actual password hash field in /etc/shadow, its prefix tells you how the password has been encrypted. From man (5) shadow :
How it was encrypted broadly depends on how old the installed OS happens to be. Its important to pay special attention to the second field in /etc/shadow.
You should make every effort to follow whatever hash the system is using, be it DES, MD5, etc, since its so easy to detect.
Why not SU into to the user and run passwd?
Is there a way to generate this passwords via command line? Yes, with debian package makepasswd (but only for MD5):
But this will not work via copy and paste inside /etc/shadow To change password via script in some linux distributions, you can use:
or