Users/Groups/Permissions
Homework/Lab Issues Lab 1: 8, 11h Homework 2: 1
/etc/[passwd|shadow] format passwd-> sj86672:x:28856:1000:Stuart A Jaskowiak(Blue Ash):/home/sj86672:/bin/ksh shadow-> sj86672:$1$iOk/Ynmi$FIfiuUKYy9K3DuUCr1qmX0 :14122:0:99999:7::: x in column 2 means /etc/shadow has to exist UIDs (column 3) should be unique, but don't have to be /etc/shadow stores password specific info
Groups Linux uses a private group by default sj86672:x:1000: adm:x:4:sj86672 dialout:x:20:sj86672
Tools to maintain users/groups GUI - “System”, “Administration”, “User and Groups” Command Line useradd, usermod, userdel groupadd, groupmod, groupdel vipw, vigr (dangerous)
Permissions 3 categories: drwxrwxr-x User (people with same UID) Group (people with same GID) Other (people with neither) r = 4 w = 2 x = 1
Ways to Change Permissions chmod u+rwx,g-rwx,o-rwx my_file chmod 700 my_file
Misc Commands su – switch user passwd – change passwords With a – and without a - are not 100% identical passwd – change passwords chage – check on password aging
Useful Links http://tldp.org/LDP/lame/LAME/linux- admin-made-easy/shadow-file- formats.html
Permissions, Links and the File System
Permissions 3 categories: drwxrwxr-x User Group Other
Ways to Change Permissions Start perms: ---------- chmod u=rwx,g=,o= my_file chmod u+rwx my_file chmod 700 my_file End perms: -rwx------ r == 4 w == 2 x == 1
Symbolic Links Shortcut to another file (like windows shortcut) [15:14:43]sj86672@wiley ~/cit370 $ ls -l total 1 -rwx------ 1 sj86672 staff 0 Oct 5 15:09 my_file* lrwxrwxrwx 1 sj86672 staff 7 Oct 5 15:14 other_file -> my_file*
Sym link permissions Controlled by originating file not link Sym link perms: lrwxrwxrwx chmod actually changes permission on linked file!
Display filesystem info df – displays information about disk layout and usage [root@goofie ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda6 2030736 645312 1280604 34% / /dev/sda5 11896932 288072 10994780 3% /var /dev/sda3 129225348 2942084 119613076 3% /opt /dev/sda1 77749 11236 62499 16% /boot tmpfs 1037032 0 1037032 0% /dev/shm
Umount error [15:18:48]root@wiley ~ # umount /var umount: /var busy Open file someplace in /var
du Show space used by individual files Default only shows directories du -a shows files
File Types Symbol Meaning - Regular File d Directory l Symbolic Link b Block Special File c Character Special File s Socket p Named Pipe
find Allows you to find a file in the file system structure find ~ -name “*txt” –ls find /etc –name “*cons*” -ls
find arguments mtime – last modified time +1 = more than one day ago -1 = less than one day ago size – size of file #[cwbkMG] type – type of file (see file types slide) ls – long listing, equivalent to ls -dils on each file