Linux FilePermission
Linux FilePermission
Tyes of permissions
1. Read (syntax=r)
2. Write (syntax=w)
3. Excute(syntax=x)
Commands
chmod
Syntax= chmod ugo (+-) rwx file/dir. Name (alphabetic method)
Example = chmod u+r file/dir. Name
chmod g+w admin (puting write permission on group)
chmod o+r admin (puting write permission on other)
chmod g+w-r admin
chmod u+r,g-w,o+r admin ( appling multiple permissions at once)
Numeric method
Umask
In Linux, umask is a command and a variable that
controls the default file permissions for new files and
directories . When you create a file or directory, the
permissions set by the umask are applied by default.
Acl
ACL (Access Control List) in Linux is an extended permission system
that allows defining more precise and flexible permissions for specific
users or groups, in addition to traditional permissions (such as user,
group, and others) . It provides a more granular method for controlling
access to files and directories.
Commands
1.Syntax: setfacl optons u:username:permission file/dir
name ( for user)
Example: setfacl –m u:admin:rwx manu
2. setfacl –m g:harry:rw alexa (for group)
3.getfacl filename = file information
Example = getfacl mannu
4. setfacl –x g:groupname file/dir. Name (deleting a group
or user you added)
Example = setfacl -x g:harry alexa
setfacl -x u:admin mannu
Suid
When the SUID bit is set on an executable file, that file
runs with the owner’s privileges, no matter who executes
it
Syntax: chmod u+s filename(add suid)
Chmod u-s filename(remove suid)
(note: ‘s’ sign will apper in the owner permission)
Sgid
1. SGID on Executable Files
2. SGID on Directories
Stickybit
Stop unwanted deletion
ll Command