Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-19-2007, 07:06 AM   #1
LQ Newbie
Registered: Jan 2007
Distribution: CentOS 6.5
Posts: 21

Rep: Reputation: 0
useradd -p <encrypted password>

I'm about to convert my company workstations from slackware to red hat enterprise using a red hat satellite server. For those of you new to the satellite server it basically allows you to install a red hat OS across your network with one boot cd and a short command at the start then it's hands off. This makes it easier to update and install mass amounts of workstations at one time.

One of the features of a "kickstart" they call it is the post script where you can basically input shell commands to be run after the OS is installed. I would love to be able to utilize this to create all of the admin accounts with the following:

useradd <admin_name> -G wheel -p <encrypted_password>

another option to solve the same issue could be:
useradd <admin_name> -G wheel
echo "<entry from /etc/shadow>" >> /etc/shadow

I'm having some real issues solving either of these options. I'm unsure of how to use the crypt command to generate a proper password entry. Also when you echo a line like what you see in /etc/shadow you lose much of the line, it seems to conflict with the "$"s. Either of these methods should have the same end results.

Thanks in advance!
Old 01-19-2007, 08:17 AM   #2
LQ Newbie
Registered: Jan 2007
Distribution: CentOS 6.5
Posts: 21

Original Poster
Rep: Reputation: 0
Solved! After toying here's how to do it:

useradd -G wheel -p <encrypted password>

where <encrypted password> is:

1- create shadow entry using passwd on linux box
2- tail the /etc/shadow and you'll see:
3- Highlight everything from "$1$<string1>$<string2>"
4- paste this after the "-p" in useradd
5- escape out the "$"s using "\"
6- hit enter!

end result should be:
useradd -G wheel -p \$1\$<string1>\$<string2>

Last edited by jeewiz; 01-19-2007 at 08:19 AM.


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
Encrypted Password alejandroye Linux - Security 2 03-01-2006 02:12 PM
root password not encrypted meskensj Linux - Newbie 3 10-19-2005 04:56 AM
useradd without shadow password twallstr Linux - Software 1 09-08-2005 02:14 PM
Password Problems With useradd Jude Lucien Debian 4 08-18-2005 10:44 AM
set logon password without useradd? ldp Linux - Security 2 01-22-2005 07:12 PM > Forums > Linux Forums > Linux - Newbie

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

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