Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Add / delete file permissions under Linux (ubuntu)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

[permission section]

In the ubuntu system, different users and different user groups have different permissions to operate files. Through the console, we can quickly operate the permissions of files.

There are two ways to change permissions for modifying permissions. Let's take a look at the composition of file system permissions:

File permissions 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:-(for type) × × (owner) × × (group of users) × × (other users)

Option 1:

Let's use the chmod command to modify the permissions of the file

Sudo chmod 644 × × (only the file owner has read and write permissions) sudo chmod 644 × × (file owners have read and write permissions, group users only have read permissions) sudo chmod 700 × × (only file owners have read and write and execute permissions) sudo chmod 666 × × (all users have read and write permissions) sudo chmod 777 × × (all users have read and write rights and execute permissions)

Explanation:

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

2. The three digits correspond to the permission settings of each user type, with a value of 00007, that is, binary [000] ~ [111].

3. Other permissions [000] do not have any permissions [100] read-only permissions [110] read-write permissions [111] read-write execution permissions

Option 2:

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

Command format:

Sudo chmod [Operand + permission increase or decrease + operation authority] × ×

Example:

Sudo chmod uperw × × × # add the "writeable" permission of the file owner sudo chmod Ulyw × × × # remove the "writeable" permission of the file owner sudo chmod grubr × × × # add the "readable" permission of the user group sudo chmod Olam × × × # remove the "writeable" permission of other users sudo chmod + x × × × # add the "executable" permission of all users

Explanation:

Operation object: U for file owner, g for group users, o for other users, a for all users

Permission increase or decrease: + means to increase permissions,-means to cancel permissions, and = means to set unique permissions

Operation permissions: r for readable, w for writable, x for executable

The above Linux (ubuntu) to add / delete file permissions is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report