choccarlm
asked on
useradd command
Hi,
I need to be able to run the "useradd" command via a script, but the problem is, is that the password doesnt get set properly using the -p option. When I run the following command
useradd -s /bin/false -p 1234 test
It adds the user, but the password in /etc/shadow isnt encrypted, it appears as "1234", and I cant logon via ftp or pop3 using this account until I manually set the password.
Is there any way I can set this password correctly using the useradd command in a shell script?
Cheers
I need to be able to run the "useradd" command via a script, but the problem is, is that the password doesnt get set properly using the -p option. When I run the following command
useradd -s /bin/false -p 1234 test
It adds the user, but the password in /etc/shadow isnt encrypted, it appears as "1234", and I cant logon via ftp or pop3 using this account until I manually set the password.
Is there any way I can set this password correctly using the useradd command in a shell script?
Cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, thanks.
Shall I delete the question, or is awarding the points to yourself the done thing?
Shall I delete the question, or is awarding the points to yourself the done thing?
What to do with the question is up to you. Although you didn't realize it at the time, you had found the answer before I commented on the question. It doesn't matter to me whether you delete the question or accept the comment as the answer.
ASKER
useradd -s /bin/false -p <password> <login>
echo "<password>" | passwd --stdin <login>
But is this the only way of getting it to work?