Linux/Unix file permissions

Permission Types

Each file or directory has three basic permission types:

read – The Read permission refers to a user’s capability to read the contents of the file.

write – The Write permissions refer to a user’s capability to write or modify a file or directory.

execute – The Execute permission affects a user’s capability to execute a file or view the contents of a directory.

Permission Groups

Each file and directory has three user based permission groups:

owner – The Owner permissions apply only the owner of the file or directory, they will not impact the actions of other users.

group – The Group permissions apply only to the group that has been assigned to the file or directory, they will not effect the actions of other users.

all users – The All Users permissions apply to all other users on the system, this is the permission group that you want to watch the most.

Viewing the Permissions
You can view the permissions by reviewing the output of the \”ls -l\” command while in the terminal and while working in the directory which contains the file or folder.
The permission in the command line is displayed as:


– rw – r – – – – – –  1  user_name  project_name  1925   Jul 22  15:33  PreFP.wb
drwxr – x – – –    5  user_name  project_name  4096   Jul 22  15:33  prev
lrwxrwxrwx    1  user_name  project_name      29   Jul 22   14:19  setup.tcl -> /proj/project_name/setup.tcl

The first character:

_ – no special permissions
d – directory
l – The file or directory is a symbolic link

The following set of three characters (rwx) is for the owner permissions.
The second set of three characters (rwx) is for the group permissions.
The third set of three characters (rwx) is for the all users permissions.

Modifying the Permissions
When in the command line, the permissions are edited by using the command chmod. You can assign the permissions explicitly or by using a binary reference as described below.

chmod  754  PreFP.wb

The numbers are a binary representation of the rwx string.
r = 4
w = 2
x = 1


 

Comments

So empty here ... leave a comment!

Leave a Reply

Your email address will not be published.

Sidebar