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

How does ​ linux set permissions for directories and files?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Linux sets permissions for directories and files:

Setting permissions for a file or directory through the chmod command can be expressed in two forms: character form and numeric form. The r, w, x permission characters can be represented as octal digits 4, 2, 1, respectively, indicating that a combination of permissions requires the accumulation of numbers.

For example, "rwx" can be expressed as "7" in the form of cumulative numbers, "rmurx" can be expressed as "5", and "rwxr-xr-x" consists of three permission segments, so it can be expressed as "755".

The file call permissions of Linux/Unix are divided into three levels: file owner, group, and others. Chmod can be used to control how files are called by others.

Grammar

Chmod [- cfvR] [--help] [--version] mode file...

Parameter description

Mode: permission setting string, in the following format:

[ugoa...] [[+-=] [rwxX]...] [,...]

Example

Set the file file1.txt to be readable to everyone:

Chmod ugo+r file1.txt

Set the file file1.txt to be readable to everyone:

Chmod Aguilr file1.txt

Set the file file1.txt and file2.txt as the owner of the file, which can be written by those who belong to the same group, but not by others:

Chmod ug+w,o-w file1.txt file2.txt

These are the details of how linux sets permissions to files, please pay attention to other related articles!

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