Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 1st February 2009, 07:41 PM
CD-RW's Avatar
CD-RW Offline
Registered User
 
Join Date: Nov 2006
Posts: 555
Creating a new user account from a shell script.

I'm trying to automate the process of upgrading as much as possible. I want to be able to create a new ordinary user account in a post installation bash script. This will allow me to create a user account from a script, without having to start a GUI in X11.

Reading the man page for useradd says:

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

There is not a crypt command on the system to create the encrypted password?

How do I create the encrypted password for a new user account
Reply With Quote
  #2  
Old 1st February 2009, 08:53 PM
wathek Offline
Registered User
 
Join Date: Jan 2009
Posts: 49
the crypt command is in the mcrypt package you need to install that one to get the crypt command

Linux Archive

Last edited by wathek; 9th February 2009 at 03:05 PM.
Reply With Quote
  #3  
Old 1st February 2009, 10:11 PM
CD-RW's Avatar
CD-RW Offline
Registered User
 
Join Date: Nov 2006
Posts: 555
Quote:
Originally Posted by wathek View Post
the crypt command is in the mcrypt package you need to install that one to get the crypt command
Thnks for that reply wathek. I have installed mcrpyt now. It appears that crypt has been replaced with the mcrypt command?

Thanks again!
Reply With Quote
  #4  
Old 2nd February 2009, 01:40 PM
CD-RW's Avatar
CD-RW Offline
Registered User
 
Join Date: Nov 2006
Posts: 555
Thumbs up

I could not get on with the mcrypt command at all. So my way to create a new user with an active password from a bash script is this:

Code:
# -------------------------------------------------- #
# Create test user account for rodney.

echo "Creating new user account for rodney."

echo

useradd \
--comment 'User test account' \
--uid 505 \
--gid users \
-M \
rodney

# Create login password for rodney.
lusermod -P 'plain-text-password' rodney

# -------------------------------------------------- #

exit 0
The '-M' option does not create the user's home directory. Without '-M' the home directory is created.

See also: $pinfo useradd and $pinfo lusermod for more details.

Reply With Quote
Reply

Tags
account, creating, script, shell, user

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hotkey problem: how can I run shell script as regular user? David Batson Using Fedora 1 15th August 2009 04:56 PM
Install into root account instead of normal user account myisty Using Fedora 1 3rd June 2007 08:27 PM
Creating a user account cdawley4 Using Fedora 2 3rd July 2005 02:42 AM


Current GMT-time: 02:45 (Thursday, 20-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat