Saturday, January 8, 2011

Chmod

Basic
r= read, w= write, x= execute.
u= user, g= group, o= others.
r= 4 w = 2 x = 1
4 = read
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read, write, and execute (4+2+1)


Examples
chmod 444 = owner can read, group can read, others can read.
chmod 446 = owner can read, group can read, others can read and write.
chmod 447 = owner can read, group can read, others can read write and execute.
chmod 644 = owner can read and write, group can read, others can read.
chmod 755 = owner can read write and execute, group can read and execute, others can read and execute.
chmod 777 = owner, user, and others can read, write, and execute.

Source:

  • http://www.zzee.com/solutions/unix-permissions.shtml
  • http://www.hostings.com/manual/sectione/using_chmod.htm
Chmod Folder, Subfolder, and Files
chmod 755 -R /path/to/directory
(source: http://ubuntuforums.org/showthread.php?t=99432)

Chmod Folder, Subfolder, but Not the Files
find /yourpath -type d -exec chmod 777 "{}" \;
(source: http://ubuntuforums.org/showthread.php?t=713590)