User Tools

Site Tools


ops102:permissions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ops102:permissions [2024/05/28 17:07] – [Permissions] chrisops102:permissions [2024/05/28 21:27] (current) – external edit 127.0.0.1
Line 258: Line 258:
  $ ls -l example001  $ ls -l example001
  -rw-r-----. 1 chris chris 0 Sep 26 11:45 example001</code>  -rw-r-----. 1 chris chris 0 Sep 26 11:45 example001</code>
 +
 +=== Recursively Setting Permissions ===
 +
 +It is sometimes useful to use the chmod ''-R'' option to recursively set all the permissions on a directory and all of its contents. However, it is quite common to need to set execute permissions on directories but not on files. You can indicate this to ''chmod'' using a capital X for the execute permission.
 +
 +  # Don't do this! It will set Execute permission on files and directories.
 +  chmod -R go+rx publicdir
 +  
 +  # Instead, do this: it will set Execute permission on directories only, and not on files
 +  # (Notice the capital X in the symbolic permissions)
 +  chmod -R go+rX publicdir
 +
 +=== Other useful chmod Options ===
 +
 +<code>
 +  -v    Verbose: show information about each file processed (whether changed or not)
 +  -c    Changes: show information about each change made (no output for unchanged files)</code>
  
 ====  Controlling Permissions on New Files and Directories  ==== ====  Controlling Permissions on New Files and Directories  ====
Line 336: Line 353:
  drwxrwxrwt. 26 root root   600 Sep 26 12:21 /tmp  drwxrwxrwt. 26 root root   600 Sep 26 12:21 /tmp
  -rwsr-xr-x.  1 root root 32760 Jan 18  2023 /usr/bin/passwd</code>  -rwsr-xr-x.  1 root root 32760 Jan 18  2023 /usr/bin/passwd</code>
 +
 +==== Securing Your Account ====
 +
 +There are two ways to secure your account on Matrix:
 +
 +1. If you do not want to share //any// of your files with other users, you can disable access to your home directory by turning off all permissions for the group and other communities. The command ''chmod go=  ~'' will set this. Since this turns off access permission to that directory, other users will not be able to access any of the files within your home directory, regardless of the permission on the individual file.
 +
 +2. If you want to share access to //some// of your files with other users, turn on the appropriate permissions for group and/or other users, and use the ''umask'' to limit the permissions on new files and directories.
 +
 +For example, you might:
 +
 +  * Start by turning off all permissions on the files and directories that are currently in your home directory:
 +
 +  chmod -r go= ~/*
 +
 +  * Create a directory of files you wish to share, called ''~/public''. Set the permission on this directory so that group and others can access it:
 +
 +  mkdir ~/public
 +  chmod go=rx ~/public
 +
 +  * Place any files that you want to share in the ''~/public'' directory and set appropriate permissions:
 +
 +  cp anyFilesYouWantToShare ~/public
 +  chmod go=r ~/public
 +
 +  * Set up you umask so that, by default, other users have no access to any new files you create (place this in your ''~/.bashrc'' file to ensure that it is applied to all new bash shells that you start in the future):
 +
 +  umask 0077
 +
 +  * Ensure that users can access your ''~/public'' directory through your home directory:
 +
 +  chmod go=rx ~
 +  
  
 =====  Access Control Lists  ===== =====  Access Control Lists  =====
ops102/permissions.1716916034.txt.gz · Last modified: 2024/05/28 21:07 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki