linux_wiki:list_set_and_change_standard_ugo_rwx_permissions

This is an old revision of the document!


List Set And Change Standard Ugo Rwx Permissions

General Information

About this page/how-to/script.


Permissions Overview

Permissions tools

  • chmod ⇒ Change permissions for user, group, other, or all
  • chown ⇒ Change user/group ownership

Chmod Modes

  • symbolic ⇒ represent permissions via u,g,o,a
  • octal ⇒ represent permissions with numbers

Change file1 ownership to rjones and group to student

chown rjones:student file1
  • You can leave off either the username or group name if only changing one of them, but the colon (:) must remain if only changing the group owner.

ls -l
-rw-r--r--. 2 root root          0 Jun 20 15:11 file1
-rw-r--r--. 2 root root          0 Jun 20 15:11 file2
drwxr-xr-x. 3 root root         17 Jun 20 14:50 newdir
  • First column ⇒ - (file), d (directory, l (symlink)
  • Columns 2-4 ⇒ User owner permissions (rwx)
  • Columns 5-7 ⇒ Group permissions (rwx)
  • Columns 8-10 ⇒ Other permissions (rwx)

Symbolic

  • u ⇒ user owner
  • g ⇒ group
  • o ⇒ other users
  • a ⇒ all users

Add write permissions to a file for the group

chmod g+w file1

Take away read permissions for others, for all of dir1 directory and its contents

chmod -R o-r dir1
  • -R ⇒ recursively

Add execute permissions to directories only in a tree

chmod -R ug+X dir1
  • For user owner and group ⇒ Adds execute to dir1 and all sub directories, not files.

Octal

  • 4 ⇒ read
  • 2 ⇒ write
  • 1 ⇒ execute
  • Add together to get permissions

Set file1 permissions using octal notation

chmod 740 file1
  • user owner ⇒ read(4),write(2),execute(1) permissions (4+2+1=7)
  • group ⇒ read(4) permissions
  • others ⇒ no(0) permissions

  • linux_wiki/list_set_and_change_standard_ugo_rwx_permissions.1456718326.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)