LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 06-14-2004, 01:46 PM   #1
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Rep: Reputation: 15
useradd command question


I want to add user with password but when I looked up man useradd it says: -p passwd (use CRYPT(3)). What does it mean? and for example, if I want to add user user1 with password 12345 what should I type?

ps. I tried useradd -p 12345 user1 but it didn't work.
 
Old 06-14-2004, 02:10 PM   #2
idaho
Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: RedHat, Libranet
Posts: 438

Rep: Reputation: 30
What it means is that you have to pass an encrypted password string
as the argument to your "useradd -p" command. The crypt(3) reference
is telling you where in the man pages (section 3) you can find information
about crypt.

I use the following perl script to encrypt a password when I need to do this:
~~~~~~~~~
#! /usr/bin/perl
($password, $salt) = @ARGV;
$password or die "usage: mycrypt password [salt]\n";
$salt = "cc" unless $salt;
$cryptpw = crypt($password,$salt);
print "$password -> $cryptpw \n";
~~~~~~~~~

In the above script, salt is a two character string that is used as the basis
for the encryption of the password. To use the script, (after saving it as
"myscript" and making it executable) invoke:
./myscript password

Use the string that is generated by the script as the argument after the
-p option in your useradd invocation.

Good luck.
 
Old 06-14-2004, 04:47 PM   #3
vectordrake
Senior Member
 
Registered: Nov 2003
Location: NB,Canada
Distribution: Something alpha or beta, binary or source...
Posts: 2,280
Blog Entries: 4

Rep: Reputation: 47
forget adding a password at the time of creation. Do it immediately after. If you have created "user1", then use "passwd user1" and enter the password. Done. No fighting with switches and encryption that is handled automatically by passwd.
 
  


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 from command line question Strixy Linux - Newbie 4 08-05-2005 06:58 PM
useradd command Wolvastur Linux - Newbie 9 01-25-2005 10:01 AM
useradd command johnpayback Linux - General 4 08-13-2002 05:24 PM
useradd command johnpayback Linux - Newbie 5 08-13-2002 10:22 AM
useradd command allancondino Linux - General 5 04-27-2002 12:01 PM

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

All times are GMT -5. The time now is 07:34 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