LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-08-2016, 10:12 PM   #1
luofeiyu
Member
 
Registered: Aug 2015
Posts: 166

Rep: Reputation: Disabled
How to create password with -p option?


To create username test2 with command :
useradd -s /usr/bin -d /home/test2 test2
and to create the passwd.
passwd test2

Why can't write them into : useradd -s /usr/bin -d /home/test2 -p test2
 
Old 04-08-2016, 11:05 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,627

Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
Quote:
Originally Posted by luofeiyu View Post
To create username test2 with command :
useradd -s /usr/bin -d /home/test2 test2
and to create the passwd.
passwd test2

Why can't write them into : useradd -s /usr/bin -d /home/test2 -p test2
The answer is inside your machine. Enter this in a terminal:
Code:
man useradd
man passwd
GNU/LInux documentation is ample for a new user to begin learning and using, just use the "man" command.

Hope that helps. Good luck.

m.m.
 
1 members found this post helpful.
Old 04-08-2016, 11:16 PM   #3
luofeiyu
Member
 
Registered: Aug 2015
Posts: 166

Original Poster
Rep: Reputation: Disabled
useradd -s /usr/bin -d /home/test3 -p passwd test3
 
Old 04-09-2016, 08:13 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,688

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
NOTE: the password specified by the -p option of useradd must already be encrypted...

Code:
       -p, --password PASSWORD
           The encrypted password, as returned by crypt(3). The default is to
           disable the password.

           Note: This option is not recommended because the password (or
           encrypted password) will be visible by users listing the processes.

           You should make sure the password respects the system's password
           policy.
And note that the "crypt(3)" is for DES passwords only, and is insecure. It is much better to use the passwd utility.
 
  


Reply


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
[SOLVED] ln with -t option, to create relative symlink not working abefroman Linux - Newbie 3 02-16-2015 06:57 AM
[SOLVED] how to ssh into host with password option antodaniel Linux - Software 4 07-27-2011 08:01 AM
[SOLVED] No Root Password or Shutdown option - 9.10 bassplayer69 Ubuntu 6 10-31-2009 02:19 PM
Can you have password complexity and use the option nullok? steve.goldner Linux - Security 1 04-25-2009 04:11 AM
Password option Moataz Red Hat 5 05-01-2005 10:46 AM


All times are GMT -5. The time now is 10:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration