How to read Permissions of a File or Directory in Linux :
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 testdir -rw-r--r-- 1 tchin users 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.
No comments:
Post a Comment