Manually Creating a New User Account - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Manually Creating a New User Account

Description:

... must match the directory name located in the sixth field ... Option meanings: u: User ID. g: Primary group. G: Comma-separated list of secondary groups ... – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 16
Provided by: carls88
Category:

less

Transcript and Presenter's Notes

Title: Manually Creating a New User Account


1
Manually Creating a New User Account
  • Presented by Carl South

2
When creating new user accounts, several steps
must be followed
  • Assign username, uid and primary group etc.
  • Enter this information into /etc/passwd file
  • Assign password to the account
  • Create home directory for the user
  • Place initialization files into users home dir
  • Give the user ownership and access
  • Testing the new account

3
The /etc/passwd file
  • Systems master list of information about users
  • Format for each user contains seven fields
  • Simply use any text editor to open file and add
    another user
  • Example
  • namecoded-passwdUIDGIDuser informationhome-di
    rshell
  • Note It is always a good idea to save a copy of
    the unedited version so that you can recover from
    any errors

4
The /etc/passwd file
  • Name - The user name assigned to the user. Most
    user names follow a certain pattern.
    My user name at work is csout0.
  • Coded passwd - (Discussed later)
  • UID - User ID Each distinct user should have a
    unique user ID
  • GID - Group ID Determines the users primary
    group membership
  • User Info - Usually contains the users full
    name. Also a comment field.
  • Home Directory - Users initial working directory
  • Shell - The command interpreter used for the new
    user such as korn, bash, bourne etc.

5
The /etc/passwd file (password field)
  • There should be an asterisk ( ) placed in this
    field when editing the /etc/passwd file.
  • Why? This prevents anyone from using this name
    to log in. Asterisks are not located in the
    target character field for passwords, so it can
    never be matched. Maintains system security if
    you are interrupted while creating the account.
  • Passwords should never be assigned while editing
    the /etc/passwd file. The passwd command can be
    used later in the creation of the account.

6
The /etc/passwd file
  • Example of an entry in the /etc/passwd file
  • csout030604222CarlSouth/home/ahvap04/csout0
    /bin/ksh

7
Assigning user passwords
  • The next step is to assign an initial password
    for the new account.
  • Command passwd username
  • You will be prompted for the password twice. It
    will not appear on screen.

8
Assigning the home directory
  • The next step is to create a home directory for
    the new account.
  • Command mkdir /home/username
  • Note The directory created must match the
    directory name located in the sixth field of the
    new entry in the /etc/passwd file.

9
Login initialization files
  • Initialization files vary with different shells
    that are used. The bash shell uses .bash, .login
    and .bashrc
  • These files are typically located in the
    /etc/skel directory. These files must all be
    placed in the users home directory as part of
    the creation process.

10
Changing ownership of home directory
  • After creating the users home directory, it is
    important to remember to change the ownership of
    the directory from root to the new user.
  • Command chown -R username /home/username
  • This command will change the ownership on the
    directory and all the files it contains.

11
Testing the account
  • After changing ownership, you should log
    completely out and then log back in under the new
    account name using the password that was
    previously assigned.
  • Check to see that everything is in working order,
    then switch user (su - root) back to root.

12
Testing the account
  • Once you are back as root, create a pre-expired
    password for the new account.
  • Command passwd -f username
  • This will pre-expire the password, forcing the
    user to change it at the next login.

13
Automating the process
  • A script can be created to automate this process.
    Lets say the script is called make_users. This
    script will make use of a command called useradd,
    which comes with many options.
  • Make_users will take one argument on the command
    line that will be the username to be used in
    creating the account.

14
Automating the process
  • Make_users
  • useradd -u 100 -g student -G tty, other -d
    /home/1 -s /bin/ksh -c comment field -k
    /etc/skel -m 1
  • Option meanings
  • u User ID
  • g Primary group
  • G Comma-separated list of secondary groups
  • d home directory path name
  • s shell
  • c Full name
  • k skeleton directory containing initialization
    files
  • m Defines the username

15
References
  • Essential System Administration, 2nd. Ed..
    OReilly Associates, Inc.
  • September 1995. Pg. 144 - 177.
  • Unix System Administration. The Seale Group,
    Inc.
  • 1996. Training Module Three, Pg. 1 - 17.
Write a Comment
User Comments (0)
About PowerShow.com