Table of Contents

Chmod

chmod - change permissions on files

Note: This is only a Basic guide to chmod, covering some niche areas.

To see the current permissions on files and directories (folders):

sburke@server:~$ ls -la

-rwx—r-x 1 sburke users 1834 2006-09-07 17:48 .bashrc drwxr-xr-x 2 sburke users 4096 2006-10-21 17:08 public_html -rw-r–r– 1 sburke users 73 2006-09-28 12:03 .screenrc

The format of permissions are:

——-user———- ——group———- ——world——— read, write, execute, read, write, execute, read, write, execute

Common Permissions are:

chmod 000 //removes chmod 400 //read permission to the user chmod 500 //read & execute permission to the user chmod 600 //read & write permission to the user chmod 700 //read & write & execute permission to the user.

So - mixing and matching the above numbers can give: chmod 644 //gives read&write to user, AND gives read to group and world. chmod 755 //gives read&write&execute to user, AND read&execute to group and world.

Make a Sticky Directory or File

A sticky file means that you can allow people to read and write to the file, however they cannot remove/delete the file. Similarly with a sticky directory: people can read, write and execute a directory and its contents, however they cannot remove the directory. chmod +t file chmod +t directory ls -la drwxrwxrwt The /var/tmp has the sticky permission - so people can write inside the tmp directory, but they cannot remove the directory itself.

Quickly Search for 777 files and folders

The following quick and easy command will list all files and folders with permissions specified. find -perm 777 find -perm 755


More info:

http://www-128.ibm.com/developerworks/aix/library/au-speakingunix4/?ca=dgr-lnxw07UNIXpart4