File/Directory Permissions
by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:55:35 EDT
|
Introduction
|
   
Every file and directory in Unix/Linux has read, write, and execute permissions.
Read permission means that the file can be read but not modified or deleted.
Write permission means that the file can be created, modified, or deleted.
Execute permission means that the file can be executed.
   
The execute permission is similar to a .exe file in Windows or DOS.
Directories can have permissions like files do except the permissions set for a
directory apply to every file in that directory and sub-directories.
|
|
Permissions
|
   
There are 3 sets of permissions for every file or directory -- owner, group, and global.
For each set, there are separate read, write, and execute permissions. The owner permissions
are for the owner of the file or directory. The group permissions are for everyone in the
group. The global permissions are for anyone. To see the current permissions, owner, and
group for a file or directory, type the following command:
ls -l.
This will display the contents of the directory you are in in long format. For example the list
of a file called testfile and the directory testdir would look like the following:
drwxr-xr-x 2 tchin users 32768 Aug 9 00:23 testdir
-rw-r--r-- 1 tchin users 4108 Aug 14 22:43 testfile
   
The permissions are listed in the first column. The first letter is whether the item is a
directory or a file. If the first letter is a d, then the item is a directory as in the first
item listed above, testdir. Notice, for the file testfile, the first letter is -.
The third column (tchin) tells the owner of the file/directory, and the forth column (users)
is the name of the group for the file/directory.
The next three letters are the permissions for the owner of the file, the next three letters
apply to everyone in the group, and the last three letters are for everyone else. The read,
write, and execute permissions are referred to as r,w, and x respectively.
   
Thus, for the directory testdir above, the owner tchin has read, write, and execute permissions
to the directory testdir, everyone in the group users has read and execute permissions, and
everyone else has read and execute permissions. The only one who can modify or delete any file in
this directory is the owner tchin.
|
|
What's Related
|
- Using chmod to learn how to change read, write, and execute permissions for files and directories.
- Using chown to learn how to change ownership of files and directories.
- Using chgrp to learn how to the group for files and directories.
|
|
|
|
|
All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004
|
|
|