Home Chmod and Permissions
Post
Cancel

Chmod and Permissions

Types of Permissions in Linux

  • r: read
  • w: write
  • x: execute

Permissions (rwx) levels

  • u: current user
  • g: group in which user belongs to
  • o: others
  • a: all

img

How to chagne permissions?

To change the permissions in the file or directory we use the chmod command.

1
2
3
4
5
6
7
8
    Syntax:
        chmod u+r <file_name> (For adding reading permission to the current user)
        chmid u-r <file_name> (For removing reading permission from the current user)

        chmod ugo+r <file_name> (For adding reading permisison to the current_user, group and others)
        chmod ugo+r <file_name> (For removing reading permisison from the current_user, group and others)

        chmod a+rwx <file_name> (adding permission for all)

Syntax:
Note: One user cannot change the permission of the files and directories of another user unless it’s the root user.

Chmod Numeric Mode

img Syntax:

1
2
3
4
5
    chmod 756 <file_name>
    where, 
    7 = user,
    5 = group
    6 = other user
This post is licensed under CC BY 4.0 by the author.