adding new users user as an entity - username(uid), gid. uid - typically a number for system to...

11
Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set of users that have similar functions. UID and GID together determine any user’s access rights to files and system resources. Password file - /etc/passwd file that stores user account information. Password file is readable by all but writable only by root.

Upload: shawn-ferguson

Post on 12-Jan-2016

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

Adding New Users

User as an entity - username(UID), GID.

UID - typically a number for system to identify the user.

GID – a number that recognizes a set of users that have similar functions.

UID and GID together determine any user’s access rights to files and system resources.

Password file - /etc/passwd file that stores user account information.

Password file is readable by all but writable only by root.

Page 2: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

How To:

Assign username, uid, primary group.

Enter this information in /etc/passwd.

Assign a password.

Set user account parameters, password aging, account expiration date etc.

Create a home directory – users organization on the hard disk.

Place Initialization files in the user’s directory.

Use chown and chgrp to make the user the owner of his home directory and initialization files.

Page 3: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

How to (contd) :

Add the user to other facilities like disk quota system, mail system, printing system etc.

Site-specific initialization tasks.

Test the new account.

Page 4: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

/etc/passwd File :

System’s master list of user-information.An entry :

name:coded-passwd:UID:GID:user info:home-dir:shell

Entry can be added manually or using vipw cmd.Vipw – invokes an editor on /etc/ptmp file (copy of passwd file).NameCoded-passwd : new user gets asterisk(*). * is not present in the target character set for encrypted passwords, it can never be matched. Blank passwd : no passwd required to log in.

Page 5: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

/etc/passwd file (contd) :

UID : Unique identification numbers. Conventionally UIDs less than 100 are used for system accounts.

GID : Determines user’s primary group membership. This corresponds to a group in the /etc/group file. Conventionally GIDs less than 10 are used for system groups.

User info : Only field in the entry that can have space. Also called as GECOS field. Distinct items within this field are separated by commas.

Home-dir : Initial working directory.

Page 6: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

/etc/passwd file (contd):

Shell: The program that UNIX will use as a command interpreter for this user. This program is executed whenever the user logs in.

Instead of manually editing the /etc/passwd file, it is preferable to have commands to add new user, as more than one scattered files might need to be changed. With commands all the necessary file updations can be ensured.

Page 7: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

Shadow password files :

Shadow files are protected from all access by non-root users and that store the encrypted passwords.When Shadow files are in use, the password fields in /etc/passwd are all set to “X”.Linux distributions don’t provide shadow files by default, but there is freely-available Shadow package that provides shadow password file support, password ageing and user account utilities.In systems, where shadow files are optional, pwconv command is used to create and update a shadow password file.

Page 8: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

Setting Password Restrictions:

Specifying MINIMUM and MAXIMUM password lifetimes.

Specifying the minimum password length.

An entry in the shadow password file :

Name:coded-passwd:last_changed:min-days:max_days:warn_days:inactive_days:expire_date:

Passwd command can also be used to specify password aging parameters.

Page 9: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

Creating home directory :

Use mkdir command to create the directory in appropriate location, such as :

# mkdir /home/gkalra1Login Initialization files: Files for the shell the account will run. For example, .profile file for Bourne shell.These files are used to perform tasks that only need to be executed upon login, such as : Setting search path, Setting default file protection(umask), setting terminal type and other environment variables.Shell Initialization files: Includes tasks that need to be executed whenever UNIX creates a new shell.

Page 10: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

Creating home directory (contd) :

Shell initialization files can include tasks like setting shell variables, defining shell aliases. For example, C shell uses .cshrc as initialization file.

SHELL INITIALIZATION FILES ARE EXECUTED BEFORE LOGIN INITIALIZATION FILES.

X Initialization files.

Setting File ownership : After copying the appropriate initialization files to the user’s home directory, the owner of the files and directory is changed to be the user. This is done by chown command.

Page 11: Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set

Assigning a shell :

By default, if the last field of the /etc/passwd file is empty, /bin/sh (Bourne) shell is used.

Root accounts are usually set up to use the Bourne shell.

Adding the User to other System facilities : like system privileges, disk quota, defining mail alias, setting print queue access.

Adding the user to any secondary groups.

Any other site-specific tasks.

TEST the New Account by using se to recreate a user’s environment.