« Linux at PFS | Main | Busy and sore »
March 19, 2006
Reference: Chmod and permissions in *nix
This is more or less for my reference, just so that I don't have to look it up all of the time. Behold, a chmod reference for Linux and Unix:
CHMOD
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
or: chmod [OPTION]... OCTAL-MODE FILE...
or: chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
-c, --changes like verbose but report only when a change is made
--no-preserve-root do not treat `/' specially (the default)
--preserve-root fail to operate recursively on `/'
-f, --silent, --quiet suppress most error messages
-v, --verbose output a diagnostic for every file processed
--reference=RFILE use RFILE's mode instead of MODE values
-R, --recursive change files and directories recursively
--help display this help and exit
--version output version information and exit
Each MODE is one or more of the letters ugoa, one of the symbols +-= and
one or more of the letters rwxXstugo.
Users Breakdown:
d = directory
u = user
g = group
o = others
d|uuu|ggg|ooo
Permissions Breakdown:
d = directory
r = read
w = write
x = execute
d|rwx|rwx|rwx
Mode Key:
1 = --x
2 = -w-
3 = -wx
4 = r--
5 = r-x
6 = rw-
7 = rwx
Examples:
1. Set a file to be executable by everyone:
$ chmod 555 filename
Sets: -r-xr-xr-x
2. Set a file to be read/write-able by the owner and readable by everyone else:
$ chmod 644 filename
Sets: -rw-r--r--
3. Open all permissions on a file:
$ chmod 777 filename (Note: Very dangerous to do...)
Sets: -rwxrxwrxw
One last note:
If you see permissions with a "d" in front of them, this represents that the file is in fact a directory, as seen in the example below:
Directory: /usr/bin
Permission: drwxr-xr-x
~out...
Posted by ed at March 19, 2006 03:22 PM
Comments
Post a comment
Thanks for signing in, . Now you can comment. (sign out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)