UNIX assigns file permissions to three broad categories:
- The user that owns the file
- The group that owns the file
- Everyone else (a.k.a 'world' or 'other')
Each permission category can be assigned three permissions:
- (r)ead
- (w)rite
- e(x)ecute
UNIX permissions can be represented as symbols and as octal digits
Type of files that are presently categories in Linux are as below:
Below is the crucial understanding of output that you normally see in command "ls -l"
--------------------------------------------------------------------------
Adding Read permission to User/Owner
# chmod u+r /tmp/user1.txt
Adding Write permission to User/Owner
# chmod u+w /tmp/user1.txt
Adding Execute permission to User/Owner
# chmod u+x /tmp/user1.txt
--------------------------------------------------------------------------
Adding Read permission to Group
# chmod g+r /tmp/user1.txt
Adding Write permission to Group
# chmod g+w /tmp/user1.txt
Adding Execute permission to Group
# chmod g+x /tmp/user1.txt
--------------------------------------------------------------------------
Adding Read permission to Other/World
# chmod o+r /tmp/user1.txt
Adding Write permission to Other/World
# chmod o+w /tmp/user1.txt
Adding Execute permission to Other/World
# chmod o+x /tmp/user1.txt
--------------------------------------------------------------------------
Assigning Execute permission to Group and Other/World
# chmod 011 /tmp/user1.txt
Assigning Write permission to Group and Other/World
# chmod 022 /tmp/user1.txt
Assigning Write + Execute permission to Group and Other/World
# chmod 033 /tmp/user1.txt
Assigning Read permission to Group and Other/World
# chmod 044 /tmp/user1.txt
# chmod 055 /tmp/user1.txt
Assigning Read + Write permission to Group and
# chmod 066 /tmp/user1.txt
Assigning Read +Write + Execute permission to Group and Other/World
# chmod 077 /tmp/user1.txt
--------------------------------------------------------------------------
Assigning Execute permission to Group# chmod 010 /tmp/user1.txt
# chmod 020 /tmp/user1.txt
# chmod 030 /tmp/user1.txt
Assigning Read permission to Group
# chmod 040 /tmp/user1.txt
Assigning Read + Execute permission to Group
# chmod 050 /tmp/user1.txt
Assigning Read + Write permission to Group
# chmod 060 /tmp/user1.txt
# chmod 070 /tmp/user1.txt
--------------------------------------------------------------------------
Assigning Write + Execute permission to Other/World
# chmod 001 /tmp/user1.txt
# chmod 002 /tmp/user1.txt
Assigning Read + Execute permission to Other/World
# chmod 005 /tmp/user1.txt
Assigning Read + Write permission to Other/World
# chmod 006 /tmp/user1.txt
Assigning Read + Write + Execute permission to Other/World
# chmod 007 /tmp/user1.txt
--------------------------------------------------------------------------
Assigning Execute permission to User/Owner , Group and Other/World
# chmod 111 /tmp/user1.txt
Assigning Write permission to User/Owner , Group and Other/World
# chmod 222 /tmp/user1.txt
Assigning Write + Execute permission to User/Owner , Group and Other/World
# chmod 333 /tmp/user1.txt
Assigning Read + Write + Execute permission to User/Owner , Group and Other/World
# chmod 444 /tmp/user1.txt
Assigning Read + Execute permission to User/Owner , Group and Other/World
# chmod 555 /tmp/user1.txt
Assigning Read + Write permission to User/Owner , Group and Other/World
# chmod 666 /tmp/user1.txt
Assigning Read + Write + Execute permission to User/Owner , Group and Other/World
# chmod 777 /tmp/user1.txt
--------------------------------------------------------------------------
# chmod 110 /tmp/user1.txt
Assigning Write permission to User/Owner and Group
# chmod 220 /tmp/user1.txt
# chmod 330 /tmp/user1.txt
Assigning Read permission to User/Owner , Group
# chmod 440 /tmp/user1.txt
Assigning Read + Execute permission to User/Owner and Group
# chmod 055 /tmp/user1.txt
# chmod 066 /tmp/user1.txt
Assigning Read + Write + Execute permission to User/Owner and Group
# chmod 770 /tmp/user1.txt
--------------------------------------------------------------------------
Assigning Execute permission to User/Owner and Other/World
# chmod 101 /tmp/user1.txt
Assigning Write permission to User/Owner and Other/World
# chmod 202 /tmp/user1.txt
Assigning Write + Execute permission to User/Owner and Other/World
# chmod 303 /tmp/user1.txt
# chmod 404 /tmp/user1.txt
Assigning Read + Execute permission to User/Owner and Other/World
# chmod 505 /tmp/user1.txt
Assigning Read + Write permission to User/Owner and Other/World
# chmod 606 /tmp/user1.txt
Assigning Read + Write + Execute permission to User/Owner and Other/World
# chmod 707 /tmp/user1.txt
--------------------------------------------------------------------------
Assigning Execute permission to User/Owner
# chmod 100 /tmp/user1.txt
Assigning Write permission to User/Owner
# chmod 200 /tmp/user1.txt
Assigning Write + Execute permission to User/Owner
# chmod 300 /tmp/user1.txt
Assigning Read permission to User/Owner
# chmod 400 /tmp/user1.txt
Assigning Read + Execute permission to User/Owner
# chmod 500 /tmp/user1.txt
Assigning Read + Write permission to User/Owner
# chmod 600 /tmp/user1.txt
Assigning Read + Group + Execute permission to User/Owner
# chmod 700 /tmp/user1.txt
--------------------------------------------------------------------------
Adding SUID to a file without execution permission to Group
# chmod u+s /tmp/user1.txt
No comments:
Post a Comment