What is Permissions?
"Every file or folder in Linux has access permissions. There are three types of permissions "
-
Read access
-
Write access
-
Execute access
For File :--
-
Read access :-- Permission to read a file
-
Write access :-- Permission to write to a file
-
Execute access :-- Permission to execute a program
For Directory :--
-
Read access :-- Permission to list a directory's contents
-
Write access :-- Permission to create and remove files from a directory.
-
Execute access :-- Permission to change in to a directory and do a long listing of the directory.
Change file ownership :--
-
#chown for file
-
#chown -R for directory
Change Permissions –
Symbolic method :--
-
#chmod -R <mode> <file>
Mode
-
u,g,o for user, group, other
-
+ or - for grant or deny.
-
r,w,x for read, write and execute.
Example:--
#chmod -R ugo +rwx <file name>
Numeric Method :--
Uses a three digit mode number.
-
First digit specifies owner's permission
-
Second digit specifies group permission
-
third digit specifies other's permission
Permission are calculated by adding
-
4 (for read)
-
2 (for write)
-
1 (for execute)
Example
chmod 640 <file name>