10apr08
ls -l //see all attribs, owner & group owner ls > dir_listing.txt ls >> dir_listing.txt //append
ls -al //see all attribs on all files (hidden/system included)
chown nobody * -R //recursively for subdirs change owner from ALL FILES to nobody
There are 3 types of users: (u) Owner, (g) Group, (o) Others (a) ALL updates all 3 types at once
A file has 3 types of permissions, READ (r), WRITE (w), and EXECUTE (x) A directory has types of permission, READ (listing), WRITE (create,modify,delete), EXECUTE (enter the dir)
position 0 is the type, d=dir, l=link, "-"=file
0 123 456 789 positions - rwx r-- r-- permissions
In the above example, (u) Owner = all and (g) Group = read and (o) Other = read, in Numeric that's
744 = root anything, group and others
777 = anyone does anything
644 = owner can r/w, everyone else reads (e.g. an html doc)
755 = owner r/w/x, everyone else read/execute (e.g. a web script)
The above example shows a file, where the owner has read/write/execute permissions, the Group has read permissions, and everyone else (others) has read permissions.
An abbreviated version of permissions uses numbers, Numeric (Octal) Representation
Octal Text Binary Meaning 0 --- 000 All types of access are denied 1 --x 001 Execute access is allowed only 2 -w- 010 Write access is allowed only 3 -wx 011 Write and execute access are allowed 4 r-- 100 Read access is allowed only 5 r-x 101 Read and execute access are allowed 6 rw- 110 Read and write access are allowed 7 rwx 111 Everything is allowed
//change file attributes/permissions chmod -R/c/f/v [u / g / o / a] [+ / - / =] [rwxXstugo..]
//change owner of a file chown [-Rcfv] [username][:.][groupname] foo.txt
//change group ownership chgrp [-Rcfv] groupname foo.txt
u : user g: group o : others a : all + : give permission - : take permission away = : cause the permissions given to be the only permissions of the file r : read permission w: write permission x : execute permission X: execute only if it is a directory or already has execute permission for some user s : set user or group ID on execution t : save program text on swap device u : the permissions that the user who owns the file has for it g : the permissions that the owner?s group has for a file o : the permissions that users not in the owner?s group have for it
sudo chmod a+w tmp.txt chown newusername tmp.txt