Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-27-2007, 01:18 PM   #1
LQ Newbie
Registered: Jul 2007
Posts: 4

Rep: Reputation: 0
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??
Old 11-27-2007, 01:28 PM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405

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
Old 11-27-2007, 04:29 PM   #3
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
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:


makepasswd, password, ps, useradd, usermod

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
generate a password string to be used by the useradd command powah Linux - Security 9 06-27-2023 06:23 AM
useradd -p <encrypted password> jeewiz Linux - Newbie 1 01-19-2007 08:17 AM
useradd without shadow password twallstr Linux - Software 1 09-08-2005 02:14 PM
Password Problems With useradd Jude Lucien Debian 4 08-18-2005 10:44 AM
set logon password without useradd? ldp Linux - Security 2 01-22-2005 07:12 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration