Vous êtes sur la page 1sur 1

Linux Workshop

Lab 6 User management and permis. ns


Requirements Quick Reference Objectives to learn
➢ Any Linux distribution. User and group management
useradd -m user #Create user (/etc/passwd) and homedir
#homedir is copy of /etc/skel/ #Other defaults are in /etc/default/
passwd user #Create password for user (/etc/shadow)
userdel -r user #Remove user and homedir (-r)
groupadd group #Create group in /etc/group
usermod -G group user #Make user member of secondary groups
chgrp groupname file¦dir #Change group owner of file or directory
newgrp groupname #Change the effective group id
chown username file¦dir #Change user owner of file or directory
whoami #Resolve identity crisis
id #Show user and group id's (belonged to)
To Do
groups #Show group memberships
1. Create 2 new users with id 1505 and 1506 and who #Show logged on users (user list)
with a home directory in /home. w #Show user list and used programs

2. Create a group called dep1 with id 1505 and


make the 2 new users members of the group. Permissions
ls -l or ll #List files and mode-fields (permissions)
3. Create a directory called /data/department1. #rwx rwx rwx #Permissions for usr owner, group, others
4. Make sure that all the future new files in the #r is readable, w is writable, x is executable (file) or right to enter directory
directory are automatically available for all the #r is 4, w is 2, x is 1
dep1 members and only for them.
chmod 0750 file¦dir #Set rwx (7) for usr owner,
5. Make sure that only the owner of new files can
#rx (5) for group, - (0) for others
rename or delete them.
#SUID on file: s, 4000, Set User ID, Start file with permissions of owner
#SGID on dir: s, 2000, Set Group ID, New files in directory owned by group
#Sticky bit on dir: t, 1000, Only owner can delete or rename files

chgrp group file¦dir #Set group owner of file or directory


getfacl file¦dir #Get ACL of file or directory
setfacl -m u:user:rwx file¦dir #Set ACL of file, directory for user, group

Theory Modules
LPIC 1 Certification Bible, isbn 0-7645-4772-0
➢ p. 387 Ch. 10 Managing Users and Groups
➢ p. 253-258 Working with Permissions

Extra References
➢ www.tldp.org

© October 2, 2005, mail@robertzondervan.com, author of Foundations of Linux networking

Vous aimerez peut-être aussi