Adding New users This is a routine chore on most systems

Slides:



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

Linux Users and Groups Management
6. Adding New Users Xiang Sha Cmsc 691x. 6.1 The /etc/passwd File The /etc/passwd File is a list of users recognized by the system. Login name Encrypted.
Race Condition Zutao Zhu 10/09/09. Outline Race Condition –Some functions –File format of /etc/passwd and /etc/shadow –Input Redirection Format-string.
1 The Attack and Defense of Computers Dr. 許 富 皓. 2 Passwords in Unix/Linux Systems.
Chapter 2 Accessing Your System and the Common Desktop Environment.
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.
Chapter 6 Adding New Users. Computer Center, CS, NCTU 2 Steps to add a new user 1.Edit the password and group files >vipw 2.Set an initial password >passwd.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Linux+ Guide to Linux Certification, Second Edition
Linux Commands LINUX COMMANDS.
Linux System Administration LINUX SYSTEM ADMINISTRATION.
Linux Installation and Administration Lesson 2 Tutor: George Papamarkos.
O.S security Ge Zhang Karlstad University. Outline Why O.S. security is important? Security schemes in Unix/Linux system Security schemes in windows system.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
CIS 218 Advanced UNIX 1 User and System Information CIS 218.
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.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
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.
IT2204: Systems Administration I 1 6b). Introduction to Linux.
Unix System Administration Chapter 6 Adding New Users.
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
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.
Managing Users Objectives –to be able to add, modify and remove Unix user accounts Contents –requirements for a user account –configuration files (passwd,
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.
User Management. Adding New Users Computer Center, CS, NCTU 3 ID  User ID, Group ID % id liuyh  uid=10047(liuyh) gid=200(dcs) groups=200(dcs),0(wheel),700(ta),800(security),888(wwwadm)
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
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.
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.
1. Edit the password and group files > vipw(8), pw(8) 2. Set an initial password > passwd lwhsu 3. Set quota > edquota [-u] lwhsu 4. Create user home.
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.
1 itec 400 User Administration Unix System Directories George Vaughan Franklin University.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Managing Users CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
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.
System Programming and administration CS 308
Chapter 11: Managing Users
Chapter 2 User Management
Linux Users and Groups Management
Adding New Users, Storage, File System
Unix Access Control Basic CE 2
COP 4343 Unix System Administration
The Attack and Defense of Computers
Module 13 System and User Security
Adding New Users Chapter 6.
Administering Users and Groups
Adding New Users.
Chapter 6 Adding New Users
Presentation transcript:

Adding New users This is a routine chore on most systems Automate the process Example: Lab access accounts in CS Labs Get info from MTU NID database Big Update Every semester All automated using scripts The /etc/passwd file A list of users Consults at login time to determine a user’s UID and to verify the users’ password CASE: Last year, security office called CEC and my office machine was doing port scanning to other department’s machine from use account mysql. I had MySQL database installed and mysql was a account for that purpose. Adding New Users

/etc/passwd File Example: nagios:x:667:667:Nagios Monitor:/usr/host/nagios:/bin/ksh amanda:x:33:6:Amanda user:/var/lib/amanda:/bin/ksh Each line contains seven fields separated by : Login name Encrypted Password UID number Default GID number user information: full name, office, phone, … Home directory Login shell Usually no more than 8 characters long Unique Case sensitive, do use all lower case if possible We will cover NIS later. Login name: some system won’t allow more than 8 character, like HP 11i, Solaris 8. Redhat allows 32 char long. FreeBSD allow 16 bit. Another reason to keep 8 email, older software, other machines, … email alias can be established Adding New Users

/etc/passwd File Encrypted password Encrypted password is set by Command passwd yppasswd if NIS is used Manual manipulation Copy a encrypted string Empty means no password Use fake passwd * to prevent unauthorized use of the account Default algorithm is DES Encrypt the first 8 chars with 2 character “salts” The encrypted passwd will be 13 character long Does not take too long to decode it using faster hardware Algorithm MD5 Passwords can be any length Encrypted password starts with $1$, 31character long Third party software may not accept it. MD5 encryption. You may change it to MD5 or others on Solaris 9/10, the problem is some third part software may break due assuming password is certain length. Adding New Users

/etc/passwd File UID number Discuss: 32-bit integers Limit to 32,767 if possible By definition, root is UID 0 Fake logins at the beginning of /etc/passwd: bin, daemon, … Start at 100 for assigning uids. Discuss: Reuse uid? Recycling uid? Uid across different machines? Adding New Users

/etc/passwd File Default GID number 16 or 32bit integer (signed or unsigned) GID 0 is for group root or wheel Groups are defined in /etc/group GID in /etc/passwd provides the effective GID at login time. The effective GID is not used to determine access The effective GID is used during creation of new files and directives. Use setgid bit (2000) Use newgrp command UNIX allows a user to be in upto 16 groups Adding New Users

/etc/passwd File GECOS field Home directory Login shell Record personal information about each user Home directory Users are placed in their home dirs when they log in. If home dir is missing Some system will put the user in the root dir / Some system will reject the user Login shell Typically a command interpreter (/etc/shells) Can be any program The default is sh if nothing specified Use chsh/password –e to change the default shell Be careful to change root’s default shell Login shell can be a certain program such as a captive user account. The available shells have to be specified in /etc/shells. Adding New Users

Shadow Password To prevent the dictionary password cracking -hide the encrypted password Make /etc/passwd from world readable to root readable only? Lots of applications depend on /etc/passwd to get information about user Use shadow password mechanism Move encrypted password to another file which readonly by root Besides password, shadow also has the password aging info. Mandatory in Solaris Available Shadow utility in Linux distributions crypt(password, salt) return encrypted password. if salt is “$1$ following by upto 8 character or $ it will use MD5. Utilti Pwconv to convert from shadow to nonshadow Adding New Users

Shadow Password The /etc/shadow file Readonly by superuser -r-------- 1 root root 1039 Nov 7 09:58 /etc/shadow Provides account information that’s not available from /etc/passwd – password aging info Forcing user to change password One line for each user, including nine fields separated by colons: From the date of Jan 1, 1970, The start of time in the view of Unix Adding New Users

Shadow Password username:password:lastchg: min:max:warn: inactive:expire:flag Login name Encrypted password Date of last password change Minimum number of days between password changes Maximum number of days between password changes Number of days in advance to warn users Number of inactive days before the account expiration Account expiration date Flags ruihong@dafinn examples]$ ./caldate.pl 11031 03/14/2000 [ruihong@dafinn examples]$ ./caldate.pl 18627 12/30/2020 Adding New Users

Shadow Password Example: On fc4 [root@icu0 ~]# tail -n 1 /etc/shadow millert:kE7WRAQ5jLoKY:13194::180:14::18627: [root@icu0 ~]# chage -l millert Last password change : Feb 15, 2006 Password expires : Aug 14, 2006 Password inactive : never Account expires : Dec 31, 2020 Minimum number of days between password change : -1 Maximum number of days between password change : 180 Number of days of warning before password expires : 14 Adding New Users

Shadow Password Set password aging Use password command Example, On system V, some options of password command: -n: minimum -m: maximum -f: force the change at next login -s: list -l: lock the account -u: unlock User default characteristics Solaris: /etc/default/passwd, /etc/default/login Linux: /etc/login.defs Adding New Users

On Solaris 8 On FC1: $grep PASS login.defs $more /etc/default/passwd #ident "@(#)passwd.dfl 1.3 92/07/14 SMI" MAXWEEKS= MINWEEKS= PASSLENGTH=6 On FC1: $grep PASS login.defs # PASS_MAX_DAYS Maximum number of days a password may be used. # PASS_MIN_DAYS Minimum number of days allowed between password changes. # PASS_MIN_LEN Minimum acceptable password length. # PASS_WARN_AGE Number of days warning given before a password expires. PASS_MAX_DAYS 99999 PASS_MIN_DAYS 0 PASS_MIN_LEN 5 PASS_WARN_AGE 7 Adding New Users

Group file /etc/group file Contains names of UNIX groups and member list Example: s3141.1:#$cs3141.1:3411:cs3141gr,jpwoods,ljinsok,mguclu,rcvanden,jrfreibe cs3141.2:#$cs3141.2:3412:cs3141gr,ajnowick,dmhardzi,drdeverr,joelarso Each line has 4 fields: groupname:password: gid:user-list Group password is really used For changing to another group using newgrp which the user does not belong Start gid with a large number, such as 100. Avoid collisions with vendor-supplied GIDs. Password is for newgrp No space between the name list. Adding New Users

Adding New Users Process to add a new user First, have the use sign the user agreement and policy statement Required Edit passwd and shadow files Set an initial password Create home directory For the user Copy default startup files to the user’s home directory Set the user’s mail home and establish mail aliases if applicable Others Add the user to /etc/group file Configure disk quotas Verify the account Adding New Users

Adding New Users Editing the passwd and shadow files # vi # vipw Only one person to edit the passwd at a time Prompt for shadow change Setting an initial password #passwd user Creating the user’s home directory # mkdir /home/joe # chown joe:research /home/joe # chmod 700 /home/joe Copying in the default startup files Default system-wide startup files User’s own startup files Store the typical files on a common place, such as /etc/skel Copy the startup files to user’s home dir Adding New Users

Common startup files Comamnd Filenames Typical users csh/tcsh .login Terminal type, env .cshrc Aliases, umask, history,path, env .logout Reminder, clear the screen sh .profile vi .exrc Editor options emacs .emacs_pro mail .mailrc Mail aliases, reader options xrdb .Xdefaults Fonts, color, etc startx .xinitrc X11 env xdm .xsession .exrc set tabstop=4 Adding New Users

Adding New Users Example: # cp /etc/skel/.[a-zA-Z]* ~joe # chmod 644 ~joe/.[a-zA-Z]* # chown joe:research ~joe/.[a-zA-Z]* Question: how about replacing the third line above with # chown joe:research ~joe/.* Adding New Users

Sample .profile # sample .login file if (-e ~/.hushlogin) cat /etc/motd limit coredumpsize 0k umask 022 setenv PATH /usr/ucb:/bin:/usr/bin:/usr/local/bin setenv PRINTER ps setenv EDITOR emacs mesg y biff y set prompt='`hostname`-\!>> ' echo -n "Enter terminal type: "; set tt=$< if ("$tt" != "") then setenv TERM $tt tset endif Adding New Users

Sample .profile # sample .profile file ulimit –c 0 umask 022 PATH=/usr/ucb:/bin:/usr/bin:/usr/local/bin PRINTER=ps EDITOR=emacs mesg y biff y PS1='`hostname`-\!>> ' echo -n "Enter terminal type: "; read tt if [ "$tt" = "“ ]; then tt=“vt100” fi export TERM=$tt Adding New Users

Adding New Users Editing /etc/group file Add the new user to the default group for recording purpose Add the new user to root group for “su” Add the new user to other groups for permission access control Adding New Users

Adding New Users Setting disk quotas Verifying the new login Use edquota interactively Use edquota in prototype mode – copy the definition from an existing users Disk is cheap, quotas may not be necessary Verifying the new login Login in as the new user Check home dir and permission Check startup files and their permissions: ls –al Inform the new user about their login and initial password Adding New Users

Removing Users When a user quits, remove the user. Set disk quota to zero Remove user’s crontab Remove temp files owned by the user in /var/tmp or /tmp Remove the user from passwd and group file Remove user’s home dir Make a copy Verify there is no other space owned by the user # quot /home # find –x /home –nouser -print Remove the user’s mail spool Remove the user from all other databases Adding New Users

Disabling Logins Disable a user Mark the password * Change the shell Example: +@nonenrolled::::::/usr/local/shells/gone Adding New Users

Account Management Utilities Graphic utilities Solaris: admintool / HPUX: sam /… Command utilities useradd / usermod / userdel groupadd / groupmod / groupdel Example: #useradd –c “David Hilbert” –d /home/csdept/hilbert –g student –G webadmin –m –s /bin/sh hilbert #userdel hilbert Adding New Users

Account Management Utilities Advantage: Easy to use Disadvantage Time consuming Not flexible Not all options are available Adding New Users

Standard Unix Users and Groups Typically predefined users root Superuser, uid=0 daemon Used to execute system processes bin Owns the executable files for most user commands sys Owns system files adm Owns the accounting files uucp Unix to unix copy subsystem account, owns uucp tools and files cron, mail, news, usenet, lp and lpd Pseudo-users to own files and run processes needed by the corresponding subsystems auth, auditor or audit Pseudo-user associated with the system auditing facility nobody Account used by the NFS product, uid = 65534 The password file shipped with these account disabled. Adding New Users

Standard Unix Users and Groups Typically predefined groups: system or root or wheel Under BSD, Members of this group is allowed to su to root, gid=0 daemon Traditional owner of the spooling directories kmem or mem Owns system programs needing to read kernel memory directly sys: Owns various system files tty or terminal Owns all special files connected to terminals, like write cron, mail, uucp, news Groups associated with various system facilities Note: username and group names are independent of each other. Adding New Users