File Permissions 2

This is in response to my earlier post on File permission. Read about basics of file permission in Linux in my earlier post here

           Permission
          Description
                  r
             Read

                 w
                Write               


                 x
Execute (also gives permission to change into a directory)
                X
Execute only if it is a directory or has execute permission for some user

                S
Set user or group ID on execution

                t
          Sticky bit
                u
Permission granted to user who owns the file
                g
Permission granted to user in file"s group.




• The first three (r, w, x) read, write, and execute

• The “s” permission retain the user or group ID for a file created in the directory.

• To set the user ID for any new files created in the directory to the owner of the directory, use the chmod u+s command. 

• To set the group ID for new files created in the directory to the directory’s group, use the chmod g+s command.


• If the sticky bit (the t permission) is set for a directory, the directory can only be unlinked or renamed by the root user or the owner of the directory. In its absence, anyone with write permission can delete or rename the directory.


• If the sticky bit is set for a directory, the permissions listing looks similar to the following (notice the t in the last set of permissions) :

drwxrwxrwt 22 root root 4096 Mar 30 10:57 /tmp

The last three permissions (u, g, o) are only used with the = operator to set permissions for the owner, group, others, equal to the existing permissions for the owner. For example, chmod g=u sets the group permissions
to the current permissions for the owner of the file.


TIP
To change permissions recursively (on all the files in a directory, all the files in its subdirectories, all the files in the subdirectories of the subdirectories, and so on) use the -R option to chmod such as chmod -R g+w output.txt.

Examples
. chmod ug+rw
Gives the user and group read and write permissions

. chmod -R g+r *
Gives the group read permissions for all files in the current directory and any files
and directories in the current directory, recursively

. chmod o-x
Does not let users who aren’t the owner or in the group change into the directory

File permissions can also be set graphically using the Nautilus file browser. From the desktop, click on the Places menu on the top panel and select Home Folder. Navigate to the file you want to view or change permissions for, right-click on it, and select Properties. Click on the Permissions tab as shown in Figure to view the existing permissions or change them.












Comments

0 Responses to "File Permissions 2"

Post a Comment

 

Managing Shell And its Secrets

Subscribe To Get Update On Mobile

Subscribe
Get updates of latest post on your mobile free