Thursday, May 9, 2013
Quick Linux (5): File System (Permissions (2) / Links)
SetUID & SetGID:
SetUID and SetGID gives the process owner's permissions and group's permissions
chmod u+s test.txt #gives the program both my permissions and the group's permissions
-rw-r--r-- 1 nemo staff 0 May 8 14:56 test.txt
-rwSr--r-- 1 nemo staff 0 May 8 14:56 test.txt
Directory Access Permissions:
ls -ld #display directories only
execute (can only use ls to list a file if filename is known)
read (list dir contents with ls)
ACLs: Access Control Lists:
Fine grained access, not efficient. to read more (page 116)
A pointer to a file:
Hard Links: (old way)
file appears as another file with a different name if in the same directory
ln existing file newline #command to create a hard link
s234-80:Linux nemo$ ls -i #the i option shows the inode number is the same
4647467 another 4648460 linktest 4648460 test.txt
Soft Links (Symbolic Links):
- You can create a link to a directory unlike with hard links
- A symbolic link can point to any file, regardless its location but a hard link to a file must be in the same filesystem
- Can point to a non-existent file, if created again, it will point to the new one unlike hard links.
- The size and times of the last modification are not the same with symbolic links unlike hard links.
- use the option ––symbolic or -s for symbolic with ln.
- Use absolute pathnames with symbolic links.