LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-01-2012, 01:18 AM   #1
Arjun
Member
 
Registered: Feb 2011
Posts: 120
Blog Entries: 2

Rep: Reputation: 0
useradd problem


I want to create a new user in my system. So i am using this command

Code:
useradd Arjun -p toor
The user gets created but when i login as Arjun then it says incorrect password.

When i see /etc/shadow file, i see that root password is strongly encrypted but Arjun's password written as plain text.

What wrong i am doing ?

Thanks
 
Old 08-01-2012, 01:30 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

the -p option is supposed not supposed to take the password as the argument, but the crypt of the password. There are commandline programs that can return this, but it is probably better just to set it after adding the user.

Eg as root
Code:
useradd arjun
passwd arjun
Also, depending on what distro this is you may have the higher level tool, adduser, which you may find more user friendly.

Evo2.
 
Old 08-01-2012, 01:31 AM   #3
SIG_SEGV
Member
 
Registered: Jul 2012
Location: Banglore, INDIA
Distribution: Fedora-Core
Posts: 70

Rep: Reputation: 11
I think this procedure works better...

#adduser Arjun
#passwd Arjun


because -p option isn't recommended actually... refer 'man useradd'
 
Old 08-01-2012, 01:49 AM   #4
Arjun
Member
 
Registered: Feb 2011
Posts: 120

Original Poster
Blog Entries: 2

Rep: Reputation: 0
ok

i will try with it too

ThaNks
 
Old 08-01-2012, 06:20 AM   #5
TroN-0074
Senior Member
 
Registered: Dec 2011
Location: Michigan USA
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
Code:
# useradd -m -g users -G audio,games,log,lp,optical,power,scanner,storage,video,wheel -s /bin/bash Arjun
Then issue
Code:
passwd Arjun
and type the password you want to use.
 
Old 08-01-2012, 06:42 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Another option is
Code:
echo plaintextpasswd | passwd --stdin username
This will encrypt the passwd as well as set it; handy for bulk processing
 
Old 08-05-2012, 03:44 AM   #7
Arjun
Member
 
Registered: Feb 2011
Posts: 120

Original Poster
Blog Entries: 2

Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
Hi,

the -p option is supposed not supposed to take the password as the argument, but the crypt of the password. There are commandline programs that can return this, but it is probably better just to set it after adding the user.

Eg as root
Code:
useradd arjun
passwd arjun
Also, depending on what distro this is you may have the higher level tool, adduser, which you may find more user friendly.

Evo2.
Thanks, worked successfully

Quote:
Originally Posted by SIG_SEGV View Post
I think this procedure works better...

#adduser Arjun
#passwd Arjun


because -p option isn't recommended actually... refer 'man useradd'
Thanks, this one works good too

Quote:
Originally Posted by TroN-0074 View Post
Code:
# useradd -m -g users -G audio,games,log,lp,optical,power,scanner,storage,video,wheel -s /bin/bash Arjun
Then issue
Code:
passwd Arjun
and type the password you want to use.
Giving error on execution of this command

Code:
useradd: group 'log' does not exist
useradd: group 'optical' does not exist
useradd: group 'power' does not exist
useradd: group 'storage' does not exist
useradd: group 'wheel' does not exist
zsh: exit 6     useradd -m -g users -G  -s /bin/bash Arjun
Can you tell me what we are doing in this command ?

Thanks

Quote:
Originally Posted by chrism01 View Post
Another option is
Code:
echo plaintextpasswd | passwd --stdin username
This will encrypt the passwd as well as set it; handy for bulk processing
Giving error on executing this command

Code:
echo toor | passwd --stdin Arjun
Error:
Code:
passwd: unrecognized option '--stdin'
 
Old 08-05-2012, 03:50 AM   #8
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Arjun View Post

Giving error on execution of this command

Code:
useradd: group 'log' does not exist
useradd: group 'optical' does not exist
useradd: group 'power' does not exist
useradd: group 'storage' does not exist
useradd: group 'wheel' does not exist
zsh: exit 6     useradd -m -g users -G  -s /bin/bash Arjun
Can you tell me what we are doing in this command ?
Obviously the groups you want to add a user to must exist on the system. Presumably, TroN-0074 was simply giving an example of how to add a user to multiple groups when running useradd.

Quote:
Giving error on executing this command

Code:
echo toor | passwd --stdin Arjun
Error:
Code:
passwd: unrecognized option '--stdin'
Different systems may use different versions or implementations of a given program, so you should check the man page on your system to see which options are supported. On my system, the man page doesn't mention a "--stdin" option, so I wouldn't try it there.
 
Old 08-05-2012, 07:35 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Is this for the backtrack distro?: --stdin works on RHEL/Fedora & see http://linux.die.net/man/1/passwd
 
Old 08-05-2012, 11:33 PM   #10
qweeak
LQ Newbie
 
Registered: Jan 2012
Posts: 24

Rep: Reputation: 2
Try using "adduser" command. This will ask for details in interactive mode. man adduser for details
 
  


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
useradd problem john83reuben Linux - Newbie 15 02-21-2008 11:17 PM
Useradd problem Detroit5 Linux - General 4 04-25-2006 03:24 AM
Useradd - Cannot locate /etc/default/useradd in Solaris Paean Solaris / OpenSolaris 4 12-09-2005 01:36 AM
useradd problem ruben0076 Linux - Newbie 4 01-11-2005 11:28 AM
useradd Problem deepakjena_2003 Linux - Newbie 2 01-19-2004 08:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:14 PM.

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