Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 User Management

Similar presentations


Presentation on theme: "Chapter 2 User Management"— Presentation transcript:

1 Chapter 2 User Management
CSNB113 SYSTEM ADMINISTRATION College of Information Technology Universiti Tenaga Nasional (UNITEN)

2 Objectives Examine /etc/group and /etc/passwd
Create, modify, and delete user accounts with useradd, usermod, and userdel SN 2014

3 Types of account in Unix
Root account This is also called superuser and Would have complete and unfettered control of the system Can run any commands without any restriction. This user should be assumed as a system administrator System accounts Needed for the operation of system-specific components for example mail accounts and the sshd accounts. Usually needed for some specific function on your system, and any modifications to them could adversely affect the system User accounts Provide interactive access to the system for users and groups of users. General users are typically assigned to these accounts and have limited access to critical system files and directories. Unix supports a concept of Group Account(groups a number of accounts) Every account would be a part of another group account. SN 2017

4 User ID (derives from actual name of the user)
Overview Allocate System Administrator User Account User ID (derives from actual name of the user) Consists /etc/group /etc/passwd Where is every user is commonly represented? /etc/gshadow /etc/shadow SN 2017

5 /etc/group Contains the group information for each account
Group database is maintained in /etc/group Contains GID; number and name A group compromises one or more members having a separate set of privileges A user has one primary group, AND may have one or more supplementary group All the default groups are system account specific groups and it is not recommended to use them for ordinary accounts SN 2017

6 root::0:root /etc/group Run command : cat /etc/group Field 1: name GID
Field 2: blank or x  hardly used today Field 3: numeric GID Field 4: list of user for which this is their supplementary group SN 2017

7 /etc/group root user’s supplementary group root::0:root Line1 staff::1: Line2 bin::2:root,bin,daemon Line3 sys::3:root,bin,sys,adm Line4 lp::8:root,lp,adm Line5 Line 1: num. GID = 0, name GID = root, supplementary group for root user Line 2: num. GID = 1, name GID = staff, no user has staff as supplementary group. Line 3: num. GID = 2, name GID = bin, supplementary group for root, bin and daemon user Line 4 & 5? SN 2017

8 /etc/shadow & /etc/gshadow
/etc/shadow − Holds the encrypted password of the corresponding account. Not all the systems support this file. /etc/gshadow − This file contains secure group account information. SN 2017

9 /etc/shadow For every line in /etc/passwd, there’s a corresponding entry in /etc/shadow sn010101:2u6VExtjjXHFk:12285:::::: Password Encryption SN 2017

10 /etc/passwd Store all user information except password encryption
/etc/passwd and /etc/shadow – use by login and passwd programs – for login authentication SN 2017

11 /etc/passwd Numeric UID Comment or GCOS Login shell Username
sn010101:x:210:241:Surizal Nazeri:/home/sn010101:bin/ksh Password field (not used) Numeric GID Home Directory SN 2017

12 /etc/passwd Username: name use to log on
sn010101:x:210:241:Surizal Nazeri:/home/sn010101:bin/ksh Username: name use to log on Password: no longer store user password. Replaced by x UID: numerical user identification (unique) GID: user’s numerical group identification Comment or GCOS: user details Home directory: default initial location when logging in Login shell: the first program executed after logging in SN 2017

13 Adding a User useradd command: add user to the system
Also creates user’s mailbox – set MAIL variable to point to /var/mail or /var/spool/mail # useradd –u 210 –g dba –c “Surizal Nazeri” \ –d /home/sn –s /bin/ksh –m sn010101 Options: -u: UID -g: GID -c: Comment or GCOS -d: default initial location when logging in -s: Login shell -m: ensure create home directory SN 2017

14 Adding a group groupadd command: add group to the system
# groupadd -g 123 mygroup Options: -g: GID -o: This option permits to add group with non-unique GID -r: This flag instructs groupadd to add a system account -f: This option causes to just exit with success status, if the specified group already exists. g: If the specified GID already exists, other (unique) GID is chosen SN 2017

15 Modifying Users usermod command: modify some of the parameters set with useradd – for example login shell (/bin/bash) Same arguments as the useradd command, plus the -l argument, which allows you to change the account name # usermod -d /home/sn m -l sn sn020202 SN 2017

16 Modifying group To modify a group, use the groupmod syntax
Here is how you will change the mygroup GID to 234 # groupmod -n new_groupname old_groupname # groupmod -g 234 mygroup SN 2017

17 Removing Users userdel command: remove user from the system including data in /etc/passwd and /etc/group Remove user Remove user together with their home directory # userdel sn010101 # userdel –r sn010101 SN 2017

18 Removing group Delete an existing group, all you need is the groupdel command and the group name # groupdel mygroup SN 2017

19 References Das, S. (2012). Your UNIX/LINUX The Ultimate Guide: Third Edition. McGraw-Hill Hahn, H. (2008). Harley Hahn's Guide to Unix and Linux. California: McGraw-Hill Higher Education SN 2017


Download ppt "Chapter 2 User Management"

Similar presentations


Ads by Google