I am converting some scripts from an ancient SuSe install, after a swap to ubuntu. These scripts uses a tool called mkpasswd, which sets user passwords. I wonder if there is something similar for Ubuntu so I don't have to code it myself. The tool is very simple. It reads a file like

username1:password2
username2:password2
....
usernameN:passwordN

And sets the passwords on the users.

link|improve this question

feedback

2 Answers

up vote 3 down vote accepted

chpasswd is very similar. Installed by default in ubuntu.

NAME chpasswd - update passwords in batch mode

SYNOPSIS chpasswd [options]

DESCRIPTION The chpasswd command reads a list of user name and password pairs from standard input and uses this information to update a group of existing users. Each line is of the format:

   user_name:password
link|improve this answer
I just found it myself ;) But thanks, it is indeed the right command. – pehrs Nov 5 '10 at 17:46
feedback

Ubuntu has mkpasswd - you may need to install it by running sudo aptitude install mkpasswd.

link|improve this answer
Hmmm. "No candidate version found for mkpasswd" is what I get from that command. The only thing that seems to match is "libstring-mkpasswd-perl", and that does not seem to do what I want to do... – pehrs Nov 5 '10 at 16:51
You need to enable the Universe repository first. See instructions at help.ubuntu.com/community/Repositories/CommandLine#Adding the Universe and Multiverse Repositories – fahadsadah Nov 5 '10 at 16:55
Still no luck with Universe and Multiverse enabled. – pehrs Nov 5 '10 at 17:28
Did you type sudo aptitude update after enabling? – fahadsadah Nov 5 '10 at 17:40
feedback

Your Answer

 
or
required, but never shown

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