Realize adding/deleting file permissions under Linux (ubuntu)

【Permissions】

In the ubuntu system, different users and users in different user groups have different operation permissions on files. We can quickly operate on file permissions through the console.

There are two schemes to modify permissions for modifying permissions. Here is an understanding of the composition of file system permissions:

File permission view:

1、 View file permissions command: ls -lh [option:file name]

2、 View folder permissions command ls -ld [option: folder name]

Example: -rw-r–r–

Explanation:-(representative type) ××× (owner) ××× (group users) ××× (other users)

Option One:

Now use the chmod command to modify the file permissions

sudo chmod 600 ××× (Only the file owner has read and write permissions)
sudo chmod 644 ××× (The file owner has read and write permissions, and group users have only read permissions)

sudo chmod 700 ××× (Only the file owner has read, write and execute permissions)
sudo chmod 666 ××× (all users have read and write permissions)
sudo chmod 777 ××× (all users have read and write and execute permissions)

Explanation:

1、 Where ×××: refers to the file name (when modifying the folder permissions, some need to add -ld after chmod)

2、 The three digits correspond to the permission settings of each user type, and the value is 0-7, that is, binary [000]~[111].

3、 Other permissions [000] No permissions [100] Read-only permissions [110] Read-write permissions [111] Read-write permissions

Option II:

Also use the chmod command to modify permissions, as follows:

**Command format: **

sudo chmod [Operation object + Increase/decrease of authority + Operation authority]

example:

sudo chmod u+w ××× #Add the "writable" permission of the file owner

sudo chmod u-w ××× # Delete the "writable" permission of the file owner

sudo chmod g+r ××× #Add "read" permission for user group

sudo chmod o-r ××× # delete other users' "writable" permission

sudo chmod +x ××× #Add "executable" permission for all users

Explanation:

Operation object: u means the file owner, g means group users, o means other users, a means all users

Increase or decrease of permissions: + means to increase permissions,-to cancel permissions, = to set unique permissions

Operation authority: r means readable, w means writable, x means executable

The above article on how to add/delete file permissions under Linux (ubuntu) is all that I have shared with you. I hope to give you a reference.

Recommended Posts

Realize adding/deleting file permissions under Linux (ubuntu)
Linux (ubuntu 12.04)
How to realize file sharing between Ubuntu and Windows under VMware
Install linux (ubuntu) dual system under windows system
How to install vim editor under Linux (Ubuntu 18.04)
Resolve the problems encountered in the linux environment under ubuntu
Install apache+PHP under Ubuntu
Install node.js under Ubuntu
Install python3.6 under Ubuntu 16.04
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Python MySQLd under Ubuntu
Start working under ubuntu
[python] python2 and python3 under ubuntu
Use iptables under ubuntu
2018-09-11 Install arduino under Ubuntu
LNMP installation under Ubuntu
Network configuration under Ubuntu
Ubuntu Linux study notes
Install ROS under ROS Ubuntu 18.04[2]
Install MySQL under Ubuntu
Install Yarm-PM2 under Ubuntu
Talk about | Install and use Linux system Ubuntu under Win10
How to create LVM for XFS file system under Ubuntu
Use expect to realize screen multi-window boot operation under ubuntu
How to map shared disk to window in linux under Ubuntu