Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
12-20-2011, 12:43 AM
|
#1
|
|
LQ Newbie
Registered: Oct 2011
Posts: 18
Rep: 
|
Problem with command useradd
I tried to use the command "useradd" to create an account. The complete command is:
useradd -p "$1$0up/D4zT$79ysvovohtDSgTRy7kLUr0" -s ~root/wcp/cli aaa
where "aaa" is the user name.
However, when I look at the /etc/shadow file, I see this:
aaa:-bashup/D4zT9ysvovohtDSgTRy7kLUr0:15328:0:1:1:::
The encrypted password is not what I gave in the command.
Can someone let me know why this happens? My OS is "2.6.35.6-45.fc14.i686"
(For certain reason, I do not want separate the command into "useradd" and "passwd". )
Thank you.
|
|
|
|
|
Click here to see the post LQ members have rated as the most helpful post in this thread.
|
12-20-2011, 09:10 AM
|
#2
|
|
Guru
Registered: Apr 2005
Location: /dev/null
Distribution: technixOS
Posts: 5,723
|
When you use the useradd command, supplying the password for it is in original text; It will be encrypted and added to /etc/shadow. You need to supply the actual password the user will be using, and not the encrypted hash.
Cheers,
Josh
|
|
|
|
12-20-2011, 11:26 AM
|
#3
|
|
LQ Newbie
Registered: Oct 2011
Posts: 18
Original Poster
Rep: 
|
Hi, Josh, Thank you for your reply.
With option "-p" in command useradd, you need to pass in encrypted password. If you use command passwd, then you may use plain text. Linux man page of useradd clearly says so.
I did try with plaintext as password with the command. In the /etc/shadow, the plaintext password is used as-is, not encrypted.
|
|
|
|
12-20-2011, 11:41 AM
|
#4
|
|
Member
Registered: Feb 2009
Posts: 275
Rep:
|
Try using single quotes rather than the double ones. I think what's happening is that the shell is trying to interpret $0 $1, and $7. It didn't find $1 and $7, and so leaves them out. It did find $0, the value of which is "bash".
Or you could try something without $ and /.
|
|
|
2 members found this post helpful.
|
12-20-2011, 11:52 AM
|
#5
|
|
LQ Newbie
Registered: Oct 2011
Posts: 18
Original Poster
Rep: 
|
Hi, impert,
Your suggestion worked. Thank you. And let me summarize how we should do.
1. If you pass in encrypted password without quotation marks, as impert pointed out, the '$' is not interpreted correctly.
2. If you pass in with (double) quotation mark, it is the same as above.
3. impert is correct. Pass in the encrypted password with SINGLE quotation mark. And that works!
Thank you, impert!
|
|
|
|
12-21-2011, 06:13 AM
|
#6
|
|
Member
Registered: Feb 2009
Posts: 275
Rep:
|
You're welcome.
Actually, I learned something too. I've been using useradd for years without ever realising that there was the option to set the password with it.
|
|
|
|
12-21-2011, 10:27 AM
|
#7
|
|
Guru
Registered: Apr 2005
Location: /dev/null
Distribution: technixOS
Posts: 5,723
|
Oops, I was thinking of something else. Sorry about that!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:08 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|