LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-06-2007, 04:40 PM   #1
Digital Surgeon
Member
 
Registered: Nov 2004
Location: Canada
Distribution: Ubuntu 7.10 - Gutsy Gibbon(Desktop Edition)
Posts: 184

Rep: Reputation: 30
adduser with p switch


Hello I am using ubuntu 7.10 Gutsy Gibbon. Logging in as root:
I am unable to use the useradd command with the -p switch to set a password for that user all in one line.
IE
adduser bob -p password

Am I using the wrong syntax???

Any help would be greatly appreciated
 
Old 12-06-2007, 05:39 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The -p option is for adding the encrypted password. You want to use the "passwd" program to create a password after the "useradd" command.
 
Old 12-06-2007, 06:18 PM   #3
Digital Surgeon
Member
 
Registered: Nov 2004
Location: Canada
Distribution: Ubuntu 7.10 - Gutsy Gibbon(Desktop Edition)
Posts: 184

Original Poster
Rep: Reputation: 30
Hi,
So are you saying. If the user was bob and his password would be tree:
it would be
useradd bob|passwd tree
 
Old 12-06-2007, 07:08 PM   #4
Digital Surgeon
Member
 
Registered: Nov 2004
Location: Canada
Distribution: Ubuntu 7.10 - Gutsy Gibbon(Desktop Edition)
Posts: 184

Original Poster
Rep: Reputation: 30
Thanks I got it now


Thanks very much
 
Old 12-06-2007, 07:20 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
No, run it in a separate command.
useradd bob <other options>
passwd bob
<passwd>

Another option would be to calculate the encrypted password and feed that into the command, but I don't know if that would work. The useradd command expects a "crypt" encrypted password. Your system might use bluefish or md5 instead. I don't know if you could use one of the ssl programs instead to produce the encryption. Also, the entry in /etc/shadow may contain a salt prefix.

useradd -p <(encryption_program options tree) username

Another thing you could do is use expect to input the password entry if using a script.

You might have luck looking in an Ubuntu wiki.
 
  


Reply



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
thread switch results in kernel stack switch superstition Linux - General 1 05-17-2005 11:48 PM
adduser how? hraposo Slackware 8 08-20-2004 07:35 AM
set up DSL thru SWITCH - winXp connected to SWITCH too husz Linux - Newbie 5 04-22-2004 12:08 AM
need to adduser(s) b_usa Linux - General 3 04-04-2003 07:40 PM
Adduser... Chijtska Linux - General 5 02-15-2002 07:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:50 AM.

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