Unix permissions

ls -l – lists files with their permissions.

chmod – changes permissions on a file.

chown – changes file's owner.

chgrp – changes a file's group.

special bit

|owner read bit

||owner write bit

|||owner exec bit

||||group read bit

|||||group write bit

||||||group exec bit

|||||||other read bit

||||||||other write bit

|||||||||other execute bit

|||||||||| owner

|||||||||| group size date time file name

||||||||||

-rw-r--r-- 1 unum unum 6079 2004-12-28 12:27 sample

usage:

chown [OPTION] OWNER [:GROUP] FILE

chown [OPTION] :GROUP FILE

chown [OPTION] –reference=RFILE FILE

chgrp [OPTION] GROUP FILE

chmod [OPTION] MODE[,MODE] FILE

chmod [OPTION] OCTAL-MODE FILE

chmod [OPTION] –reference=RFILE FILE

Common options:

-R recursive, if file is directory make same change to all files and directories inside of it

Examples

chmod u+x myprogram	sets the programs as executable by the owner

chmod o+x myprogram	sets the programs as executable by everyone

chmod o-r myjournal	removes the read by everyone permission

chmod g+s groupdirectory	sets the group id so ever file in the directory will belong to	the same group

chmod 750 myprogram	sets read write and execute bit for owner

sets read and execute bit for group

sets not bits for other

2005-02-18T13:50:27