Managing Users Objectives –to be able to add, modify and remove Unix user accounts Contents –requirements for a user account –configuration files (passwd,

Slides:



Advertisements
Similar presentations
Unit 5 – User Administration Randy Marchany VA Tech Computing Center.
Advertisements

Linux Users and Groups Management
Basic Unix system administration
Race Condition Zutao Zhu 10/09/09. Outline Race Condition –Some functions –File format of /etc/passwd and /etc/shadow –Input Redirection Format-string.
User Account Management WeeSan Lee. Roadmap Add An Account Delete An Account /etc/{passwd,shadow} /etc/group How To Disable An Account? Root Account Q&A.
Linux+ Guide to Linux Certification, Second Edition
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 2 Manage User Access and Security.
Linux+ Guide to Linux Certification, Second Edition
Linux System Administration LINUX SYSTEM ADMINISTRATION.
Linux Installation and Administration Lesson 2 Tutor: George Papamarkos.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Managing User Accounts. Module 2 – Creating and Managing Users ♦ Overview ► One should log into a Linux system with a valid user name and password granted.
Linux+ Guide to Linux Certification, Second Edition
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.
ITI-481: Unix Administration Meeting 3. Today’s Agenda Hands-on exercises with booting and software installation. Account Management Basic Network Configuration.
IT2204: Systems Administration I 1 6b). Introduction to Linux.
Unix System Administration Chapter 6 Adding New Users.
Day 11 SAMBA NFS Logs Managing Users. SAMBA Implements the ability for a Linux machine to communicate with and act like a Windows file server. –Implements.
Module 4 - File Security. Security Overview File Ownership Access to Files and Dircetories Changing File and Directory Ownership Changing File and Directory.
Linux+ Guide to Linux Certification, Third Edition
CIT 470: Advanced Network and System AdministrationSlide #1 CIT 470: Advanced Network and System Administration Accounts and Namespaces.
Managing Users Objectives Contents Practicals Summary
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
ITI-481: Unix Administration Meeting 3 Christopher Uriarte, Instructor Rutgers University Center for Applied Computing Technologies.
Users Greg Porter V1.0, 26 Jan 09. What is a user? Users “own” files and directories Permission based on “ownership” Every user has a User ID (UID) 
There are three types of users in linux  System users: ?  Super user: ?  Normal users: ?
Managing Users  Each system has two kinds of users:  Superuser (root)  Regular user  Each user has his own username, password, and permissions that.
Chapter 3 & 6 Root Status and users File Ownership Every file has a owner and group –These give read,write, and execute priv’s to the owner, group, and.
Introduction to System Admin Sirak Kaewjamnong. 2 The system administration’s job  Adding a new user  Doing backup and restoring files from backups.
1 LINUX SECURITY. 2 Outline Introduction Introduction - UNIX file permission - UNIX file permission - SUID / SGID - SUID / SGID - File attributes - File.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Fall 2011 Nassau Community College ITE153 – Operating Systems Session 21 Administering User Accounts and Groups 1.
User Environments Objectives –to provide appropriate environments for different types of users Contents –different login programs –user profiles –restricted.
Linux Based Networks University of Education Instructor: Muhammad Amer Irshad.
Linux Commands C151 Multi-User Operating Systems.
The Saigon CTT Chapter 10 Managing Users. The Saigon CTT  Objectives  Define the requirements for user accounts  Explain group and group accounts 
Manually Creating a New User Account Presented by Carl South.
© 2006 ITT Educational Services Inc. Linux Operating System :: Unit 3 :: Slide 1 Downloading and Installing Software yum pirut Bit Torrent rmp.
ITI-481: Unix Administration Meeting 3 Christopher Uriarte, Instructor Rutgers University Center for Applied Computing Technologies.
System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:
SCSC 455 Computer Security Chapter 3 User Security.
Lecture – Users and groups
Working with users and Groups. 1. Manage users and group 2. Manage ownership, permissions, and quotas.
Linux Use the Command-Line Interface to Administer the System.
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
SUSE Linux Enterprise Desktop Administration Chapter 9 Manage Users, Groups, and Permissions.
Chapter 6 Adding New Users. Computer Center, CS, NCTU 2 Steps to add a new user 1.Edit the password and group files >vipw, pw 2.Set an initial password.
Managing Users CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Experiment No 4 Prepared by, Mr. Satish Pise. Objectives View the /etc/passwd file and describe its syntax. View the /etc/shadow file and describe its.
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses. ©Copyright Network Development Group Module 14 Managing.
LINUX SYSTEM ADMINISTRATION
System Programming and administration CS 308
Basic Commands ls cp ls –l (in detail format) echo ls –a
Chapter 11: Managing Users
Chapter 2 User Management
Linux Users and Groups Management
IS3440 Linux Security Unit 3 User Account Management
Systems Administration CSCI Fall 2016
Adding New Users, Storage, File System
COP 4343 Unix System Administration
OPS235 Lab4: Investigations 5 – 9
LINUX SYSTEM ADMINISTRATION
Chapter Introduction 3.2 The UNIX Model of Ownership
Module 13 System and User Security
Adding New Users Chapter 6.
Administering Users and Groups
Adding New Users.
Presentation transcript:

Managing Users Objectives –to be able to add, modify and remove Unix user accounts Contents –requirements for a user account –configuration files (passwd, shadow) –adding users –modifying user details –passwords –deleting users –working with groups Practicals –to add several user accounts Summary

New User Requirements An entry in /etc/passwd, which will define the user –login name –user id –default group –descriptive name –login program (shell) An entry in /etc/shadow, which will control account access –initial password –password aging information An entry in /etc/group, for the default group assignment –one of the existing groups in this file will become user's primary group –user access to other than primary group can be allowed in this file And somewhere to store files –a home directory –an initial.bash_profile and application startup files

Preparing Groups (/etc/group) Use groups for working on projects and in departments –groups provide a second level of access control –groups will allow users to share files Setup groups before adding new users One line per group in /etc/group name :: gid : user1,user2 Entry for a new group added with groupadd utility To change or remove group use groupmod and groupdel # groupadd -g 151 swamp # groupadd -g 152 barracks # groupadd -g 151 swamp # groupadd -g 152 barracks group name numeric id list of users allowed 'secondary' access to this group

The /etc/passwd file Each valid user must have an entry in this file One line per user of the form name :: UID : GID : comment : home directory : shell –name must be unique, up to 8 alphanumeric characters, usually lower case –UID user id, a numeric value within the range of 0 to –GID user primary group, a numeric value within the range of 0 to –comment this field is free format text, usually fuller description of the user –home directory this is the account location, usually under /home –shell startup program, it is optional (but last colon isn't) –if no value given, it defaults to /usr/bin/sh –recommended shell is /usr/bin/ksh –the shell can be any executable program $ grep root /etc/passwd root:x:0:0:root:/root:/bin/bash operator:x:11:0:operator:/root:/sbin/nologin $ grep root /etc/passwd root:x:0:0:root:/root:/bin/bash operator:x:11:0:operator:/root:/sbin/nologin

Allocating User IDs (UIDs) Zero always used by root Entries less than 100 refer to special system accounts rootsuperuser - unrestricted access to entire system daemonlooks after background processes binowns some system commands uucpowns uucp files and processes mailmailserver daemon newsinternet news daemon atbatch daemon jobs ftpowns ftp filesharing namednameserver user for the dns ntptimeserver user sshdSecure shell subsystem haldaemonhardware abstraction layer daemon lpline printing subsystem user nobodyguest user Local user accounts normally start at 100 or higher –each user should have a unique user id User accounts normally start at 500 or higher –networked systems should use consistent user UIDs

Adding Users Don't edit the control files manually Use utilities such as useradd (SVR4), mkuser (AIX) –useradd creates required record in /etc/passwd and /etc/shadow files –allows to create directory structure for the new user Useful options to useradd to override defaults -u uid specify new user id (default: next available number) -g group specify default group (default other, GID=1) -c comment description of user (default blank) -d dir home directory -m make home directory (recommended, default /home/username ) -k skel_dir skeleton home directory (default /etc/skel) -s shell specify login program (default /bin/bash) Don't forget to give the user an initial password # useradd -m henry # useradd -u 321 -g 152 -m -s /bin/bash hotlips # useradd -m henry # useradd -u 321 -g 152 -m -s /bin/bash hotlips

Changing User Attributes Don't edit the control files manually Use supplied utilities such as usermod (SVR4), chuser (AIX) –usermod uses the same basic set of options that are used with useradd –if you modify UID then use -U option as well, to change the UID of files belonging to the user, but... –...only files in user's home directory, mail file and cron file will be affected, other files must be located and ownership modified manually Account inactivity and expiry date can also be set by usermod # usermod -g users -c "Henry Blake" henry # usermod -U -u 321 -s /bin/bash hotlips # usermod -g users -c "Henry Blake" henry # usermod -U -u 321 -s /bin/bash hotlips # usermod -f 10 henry # usermod -e 01/31/05 hotlips # usermod -f 10 henry # usermod -e 01/31/05 hotlips

Changing Group Membership Each user belongs to a group (defined in /etc/passwd) –primary membership can be changed with usermod -g User can also be allowed access to other groups –secondary membership is controlled by usermod -G –the group must already exist # grep trapper /etc/passwd trapper::416:400::/home/trapper:/bin/bash # groupadd -g 600 swamp # usermod -G swamp trapper # grep trapper /etc/group swamp::600:trapper # grep trapper /etc/passwd trapper::416:400::/home/trapper:/bin/bash # groupadd -g 600 swamp # usermod -G swamp trapper # grep trapper /etc/group swamp::600:trapper add new group trapper's primary group is 400 add trapper to group 600 (his primary membership unchanged)

Exercise - Adding and Modifying Users Write down the commands to perform the following: # add a user called frank # add a user called radar specifying the Korn shell # add a user called klinger using /home2/klinger as the home directory # add a user called mulcahy specifying a UID of 400 and a group of staff # modify the user frank to use the korn shell # modify radar to give him a new UID of 401 # add a user called frank # add a user called radar specifying the Korn shell # add a user called klinger using /home2/klinger as the home directory # add a user called mulcahy specifying a UID of 400 and a group of staff # modify the user frank to use the korn shell # modify radar to give him a new UID of 401

Setting Passwords New user accounts have to have an initial password Forgotten passwords have to be reset –Verify that the person asking to reset the password is the account owner Use the standard passwd program with a username –as root you will not be prompted for an existing password –choose a simple password and inform the user verbally Lock the user account # passwd -l henry # passwd henry new password: retype password: # passwd henry new password: retype password:

Choosing Passwords Too many passwords are easy to guess –1980's survey on US systems guessed 80% of passwords –standard password guessing programs readily available Advise users on sensible passwords –no proper words or names –use letters and digits –include symbols Most systems enforce basic rules –minimum password length –use of non alphanumerics –some system can use dictionaries of disallowed words Systems like SuSE and RedHat keep a password history –used to stop users cycling round a few favourite passwords Don't have guest accounts –if someone has to use your system give them an account with password

The /etc/shadow file Each valid user must have an entry, of the format: name : password : last change : min : max : warn : inactive : expire : flag –name user login name, cross-reference to /etc/passwd file –password valid (encrypted) passwords have exactly 13 characters –if this field is blank there is no password –NP in this field implies no password has been set (login not accessible) –LK or * in this field implies the account is never used (locked) –last change number of days of last password change since 1/1/70 –min minimum number of days between password changes –max maximum number of days the password is valid –warn number of days before expiry that user will be warned –inactive number of inactivity days allowed for this user –expire an absolute date, beyond which the account will be disabled $ grep root /etc/shadow root:b93.GT2r.7IZ6:9718:0:60:7::: $ grep root /etc/shadow root:b93.GT2r.7IZ6:9718:0:60:7:::

Account Security Use preset expiry dates for temporary employees –very useful for contract staff Use inactivity counts to lock unused accounts –perhaps the user has left the company and no one told you Change passwords known by someone who leaves –change ALL passwords if they knew the root password Lock accounts if they are temporarily unused –user is on secondment or holiday Use the password ageing mechanism! # passwd -l trapper # passwd -n 27 -x 30 -w 3 radar # usermod -e 12/24/05 hotlips # usermod -f 5 hotlips

Exercise - Account Security Write down the commands to perform the following: # add a password for user frank # force frank to change his password at next login # enable password ageing for trapper (min 21 max 31 warn 7) # set the expiry date for hawkeye to 31 Jan 2005 # lock henry's account # now unlock henry's account # add a password for user frank # force frank to change his password at next login # enable password ageing for trapper (min 21 max 31 warn 7) # set the expiry date for hawkeye to 31 Jan 2005 # lock henry's account # now unlock henry's account

Removing User: Preparation When a user leaves there are two main concerns: –protect the system from unauthorised access via his/her account –protect and manage his/her files and directories left on the system Proposed sequence of steps –lock the account password, until you are ready to remove it altogether –save all files owned by the user, somewhere outside the home directory –change access permission on saved files, allowing access to root only –consider cron or at jobs setup by the user –set up mail forwarding to send mail to a manager # passwd -l henry # mkdir /hold; chmod 000 /hold # cd / # find. -user henry -print | cpio -ov | compress >/hold/henry # find. -user henry -type f -exec rm -f {} \; # find. -user henry -type d -exec rmdir {} \; # su - henry -c ”echo ’bigboss’ > ~henry/.forward" # passwd -l henry # mkdir /hold; chmod 000 /hold # cd / # find. -user henry -print | cpio -ov | compress >/hold/henry # find. -user henry -type f -exec rm -f {} \; # find. -user henry -type d -exec rmdir {} \; # su - henry -c ”echo ’bigboss’ > ~henry/.forward"

Removing User Account Delete user account only when his/her data is safe Use userdel utility (SVR4) or rmuser (AIX) Without any options userdel will leave all files owned by that user untouched and open to misuse. –the -r option with userdel will remove user files, but only those in the home directory (including the home directory itself) –userdel does not remove mail file –more significantly, userdel does not remove user's cron table or stop cron from executing the task scheduled by that user # userdel -r henry

Summary User account information stored in 3 files: /etc/passwd /etc/shadow /etc/group Account information contains: –login name –password –user and group ids –full name –home directory –login shell SVR4 provides utilities for manipulating user details passwd useradd, usermod, userdel groupadd, groupmod, groupdel