Chmod how to understand values

When working with Linux, the user will have to grant or change access rights to files and directories. Use the command to display the access rights to files and directories ls –l.

Permissions are encoded with security bits represented e.g.. by writing:

The first signs mean:

  • d - stands for directory
  • - means a file
  • l - means a symbolic link

The next nine bits of rwxrwxrwx are responsible for the file or directory access settings:

  • r - readable
  • w - the ability to write
  • x —Possibility to run

The first three bits of the rwx specify the permissions for file owner, the next three define user access security groups, to which the owner of the file belongs, and the last three relate to other system users.

A= Owner B= group C= All (Others)

ABC
chmod774

From the example above, chmod can be seen, that:

Owner and group: Full rights
Others: Read only

 

Explanation of permission numbers - linux

DigitPermissions
0Lack
1follow
2Save
3Make and save
4Read it
5Read and execute
6Read and write
7Read it, save and execute

Giving chmod permission to a file or folder

In the terminal through which you give commands to your linux, for example,. Ubuntu, enter e.g.:

chmod 774 nazwaPliku.sh

and click enter.

Thus, you have given permission to the file "filename.sh" 774, that is, the owner and the group have full rights, while others only read. You assigned the permissions from the example above with this method.

Change of file owner - chown

To change the owner of a file, use the command chown, with syntax:

How useful this post was?

Click on the star, to evaluate it!

Average grade / 5. number of votes:

So far, no votes! Be the first to rate this post.