Penguin
Note: You are viewing an old revision of this page. View the current version.

Here's a directory listing (ls -l):

-rw-r--r--   1 mythtv users    1706 2005-10-13 14:01 release.keys
Columns
 -rw-r--r--   File permissions 
 1   number of links 
 mythtv   file owner 
 users   file group 
 1706   file size 
 2005-10-13 14:01   creation time 
 release.keys   filename 

This page concentrates on the file permissions.

UNIX file permissions are made up of three groups: the user who owns the file, the group that the file belongs to, and other people. These letters are important as you can use them to instruct chmod(1) change the permission of the file.

For each part, you have read, write, and execute access. These are displayed as 'rwx'.

There are also sticky bit (shown with a t when listing directories) and setuid bit shown with a s.

The sticky bit allows the use of share directories basically where only the owner of the directory or the owner of the file can delete the file within a directory (as opposed to the normal situation where if you can write files in a directory you can delete any file in that directory)

The setuid bit allows you to run the program as the file owner or group owner rather than the executor. For example the file can run as root instead of a normal user and therefore do priviledged things. However this is something you have to be very careful with as it can leave gaping security holes.

The most common commandline program to alter permissions is chmod(1).

There's an excellent guide to permissions at Greg's wiki, which you should go and read right now. Linux Focus also has a good article to read.

And remember the less permissions you give the better.

Recursively Change Permissions of Just Files Or Just Folders

  • find <path> -type d -exec chmod 755 {} \;

This will recursively search your directory tree and chmod all directories only.

Chmod all files only (and ignore the directories):

  • find <path> -type f -exec chmod 611 {} \;

CategoryBeginners