HOW YOU CAN SET PERMISSION IN LINUX

~~~~~~~~~~~~~~~~~~~~~~~~~~PERMISSIONS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Permissions:- permissions on a user are of two types_______________________________
                                                             Permissions     owner         group   permission           umask
          1_Directory permissions.     |  drwxr-xr-x       root            root            755             0022
          2_File permissions.               |  -rw-r--r--          root            root            644             0022
                                                          A FILE HAVE NOT THE EXECUTE PERMISSIONS BECOUSE WRITE
Read – {4}                                       PERMISSION FOR FILE ACTS AS A EXECUTES PERMISSION.
Write –{2}                       +  = 7    which is the full permission for the file or the directory.  
Execute{1}
         
1_    r:- read permission.       {4}   |for directory       drwxr-xr-x
2_    w:- write permission.    {2}   |
3_    x:- execute permission.{1}    |         this {d} shows that this permission is for directory   
4_     -:_   no permission.      {-}    |for file                -rw-r--r--    this is the permission for file.


Now permission of a file is applied on the {user}, {group} and {other user} they have all different permissions to understand below _________________........

          Take a directory it has 9 digit permission like :--------
Directory                 for Users            for Groups                 for Other users       defaults          permis..
Redhat                 d       rwx                      r-x                                 r-x              per..  7 5 5
                                      421                       421                                421              for     U G O                                                                                                                                       umask0  2  2                                                                                                                                                                       this {d} shows     {7} full permission   {5} read, execute for    {5} read , execute for the other                this is a directory for the users/ owner       all groups                       users which are not member                                                                                                             of any group.
File                                 for Users        for Groups                           for Other users           default permission
server                   {-}      rw-              r--                                         r--           per ..  6 4 4
                                         421             421                                   421         for     G U O    
                                                                                                                       Umask  0 2 2
                                                                                                                                                                                                          At first position {-}   read, write per..    only read for all groups               only read for all other users
            Shows that it’s a file   for users/owner          {{{{ }}}}}}}}}}}}}}}}}}}                                                                  

EXPLAIN  SOME OF HOW THE PERMISSIONS APPLIED ____________________________
                  
            ROOT USER OR                               GROUP USER OR ALL                   OTHER USERS WHO NOT BELONG THE OWNER OF THE FILE             MEMBERS OF THE FROUP                TO ANY GROUP.

G
O
 
U
 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                rwx                                             rwx                                                   rwx                         for dir..     7rwx                                                5r-x                                                  5r-x                               full per..          7rwx                                       7rwx                                                 7rwx                    
                                                                                                                                                            for file      6rw-                                        4r--                                                   4r--                        full per… 6rw-                                        6rw-                                                  6rw-                                        because file didn’t need execute permission only write or read permission can                             execute the file.

These are the simple permissions for a file or directory by a user for groups and other user

Now how to apply permissions
                   Go to the directory in which directory or file to which permissions are applied then run the commands                       
  Like we have to apply permission on /data file
          # cd /
       /]# chmod 777{ or any of permission u wants} file or dir.. name                        like

       /]# chmod 744 /data
Or
       /]# chmod 644  myfile

OWNERSHIP to give ownership of a file or directory to any other user BY ROOT ONLY
          # chown     pop    [filename]
                            
                                                Username

The user who  makes he file he has the full rights on his file he can do any thing with his file.

And if root write {0} in the permissions at any permissions place. Then user belogs to thet permission even can`t open his own file because {0} refers to no permission 
         
This security of {0} also acts on the groups level security if __0777 then users under group can do nothing.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The default roots id is {0}
Every user has its own primary/private group when we add this into a group then this group is its secondary group. And then this user is member of both of the groups primary  and secondary.
 After add it to secondary group then the group level security is applied on this  that is as _____

THSES PERMISSIONS IMPLIMENTS ONLY ON THE GROUPS AND USERS UNDER GROUPS.

1_ SUID____ Set User Identification.  {4}  
2_ SGID___  Set Group identification {2}
3_STICKBIT _for restriction to delete       {1}


These permissions acts only on the groups and the users under the group its add as a first digit for the permissions  like

To give a user under a group to read permission only on the other members of this group
File is pop

          # chmod     4777  pop

0 comments: