-   Linux - Newbie (
-   -   Password issues with useradd command (

mcaywood 11-27-2007 01:18 PM

Password issues with useradd command
useradd SamIam -p pokey1

I have successfuly used the above command except when I try to log onto this new user and enter the password it tells me that I have entered an incorrect password. When I try the su command from a user account, I get the same message. I can go into the GUI side and change the password then I am able to log onto this new account. Any ideas??

druuna 11-27-2007 01:28 PM


As stated in the useradd manpage:

-p, --password PASSWORD
The encrypted password, as returned by crypt(3).
Use the passwd command to set/change the users password.

You could also create a small binary yourself using the crypt() function. I just answered a similar question.

Hope this helps

matthewg42 11-27-2007 04:29 PM

You can use the makepasswd program (you will probably need to install it) to create an encrypted password from a plaintext one.

You should never use a plaintext password on the command line as an argument to a command since this can be easily seen by any user on the system who runs ps at the right moment. You might be the only user on the system, but if you get into the habit you will probably continue it when you should not, so don't.

The plaintext password should be read from the keyboard (so you might as well use the passwd program), or - if you must automate the process - from the file with the permissions set so only the root user can read it.

See this thread for an example of how to use makepasswd:

All times are GMT -5. The time now is 09:24 PM.