What's new

Welcome to Ruzgar.com

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Ask question

Ask questions and get answers from our community

Answer

Answer questions and become an expert on your topic

Contact us

Contact the site administrator directly.

Groups

Just like Facebook join them and enjoy.

Centos Lesson 6 File Permissions

ruzgar

Administrator
Staff member
Joined
Oct 3, 2021
Messages
37
Reaction score
0
Points
6
In Linux, directory write, access and read permissions are indicated by the letters RWX.

The first 3 characters are for the file owner.
2. 3 characters are for the group you have
The last 3 characters are global permissions. It's for everyone.

View attachment 62
  • r : read permission.
  • w : write permission.
  • x : execute permission.
  • - : means no authorization.
  • d means directory.
  • l : is the link of the symbol.
Examples:

  • rwxrwxrwx : Anyone can access, read, run, modify this file
  • rwxr-xr-x: Everyone reads, executes. It cannot change. It just changes the owner. It is used very often.
  • rwx--x--x: Only executable. Unreadable. It cannot be changed.
  • rw-r--r--: This application does not have permission to run. Read and Write permissions are available.
  • rw-rw----: File owner reads, changes, cannot run. Other people cannot do anything.
  • rwx------: Only file owner can access. Others cannot do anything.
  • --x--x--x: This file is executable only. No one, including the owner, can read or change it.
  • r---w----x: Owner can read, User group can write. Others can run it.
Permissions are done with the chmod command:

Code:
chmod [ugoa] [+=-] [rwxst] filename

Looks like it's confusing, let's unpack it a bit:

  • u: user
  • g: usergroup that owns the directory
  • o: others
  • a: all ie all users
  • +: authorize
  • -: get authorization
  • r: read
  • w: write
  • x : execution authorization
  • s : suid bit
  • t: sticky bit
In general, chmod permissions are also given in numbers. Here
r: 4
w : 2
X : 1
means.

With this logic, 777 team is the case with permissions. 111 only has the authority to operate.

chown command:

Chown makes the owner of a file become root.

  • chown ruzgar [com] : The owner of the com file here is now root when ruızgarken.
  • chown -R root [ruzgar] : Here we made the owner of the ruzgar folder and all the folders under it root.
Chgrp Command:

It is the command to grant access authorization.
  • chgrp ruzgar /usr/com : Only members of the ruzgar user group can access the /usr/com folder with this command.
  • chown ruzgar:ruzgar [filename / directoryname] : With this command, both the owner and the user group in the directory named directory will become ruzgar.
  • chown -h ruzgar:ruzgar com : With this command, we have made the owner and group of the file named com and the ownership of the links of the file, if any, as ruzgar.
  • chown --from=ruzgar com file.jpg : With this command, the owner of the file.jpg file is now the user named com when it was ruzgar.
Every file to be created in Linux is created with specified permissions. This is usually 022 permission. If you want to see the current permission value:
  • umask : default permission values are given as a result.
  • umask [644] : As a result, the default file permission value is changed to 644.
If we re-examine the permissions in general. Permissions are 3 digits. The first digit is read, the second digit is writing, and the third digit is Operation.

0: There is no right
2: Has the Right to Write
4: Has the Right to Read

If the umask value is 000, the directory rights will be 777. File rights will also be 666.
If the umask value is 022, the file and directory permissions are removed.
It will be 777-022=755. Directory rights will be 755.
It will be 666-022=644. Default file rights.

0-> File owner. As a result the file rights are rw- and the directory rights are rwx.
2->It is a group of files. file rights were r--,r. Directory rights are r-x
Last 2-> Other users in the system. File rights are r--'d,r and directory rights are r-x.

For example, if we want the directory rights to be 777, we will need to enter 000 in the 777-777 umask value.
 
shape1
shape2
shape3
shape4
shape5
shape6
Top