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

Permissions and attribution management and use of Linux files / directories

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

Share

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

I. Overview of the authority and attribution of documents

1. Access rights

Read r: allows you to view file contents and display directory lists

Write w: allows file contents to be modified, new files or subdirectories to be created, moved, or deleted in the directory

Executable x: allows you to run programs and change directories

2. Ownership (ownership)

Owner: the user account that owns the file or directory

Group: the group account that owns the file or directory

3. View the permissions and attribution of the file

4. Chmod sets file permissions

The basic syntax format of the chmod command is as follows:

Application examples:

[root@centos01 ~] # touch 1.txt [root@centos01 ~] # ll total usage 8 root root 1 January 11 22:27 1.txtMuy RWL. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg [root@centos01] # chmod upright x. / 1.txt [root@centos01] # ll total dosage 8 Kui root root 1 root root 0 January 11 22:27 1.txt Mustang RWMY. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg [root@centos01 ~] # chmod Umurx journal gongqijie 1.txt [root@centos01] # ll total usage 8korwashi root root XRW-1 root root January 11 22:27 1.txtMuywashi. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg [root@centos01] # chmod 755 1.txt [root@centos01] # ll total dosage 8-rwxr-xr-x 1 root root January 17 02:36 1.txtMurray. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg

5. The attribution of chown setting files

The basic syntax format of the chown command is as follows:

Application examples:

[root@centos01] # chown bob 1.txt [root@centos01] # ll Total amount 8-rwxr-xr-x 1 bob root January 17 02:36 1.txtMurray RW. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg [root@centos01] # chown: benet 1.txt [root@centos01] # ll total dosage 8-rwxr-xr-x 1 bob benet January 17 02:36 1.txtMurray. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg [root@centos01] # chown bob:benet 1.txt [root@centos01] # ll total dosage 8-rwxr-xr-x 1 bob benet January 17 02:36 1.txtMurray. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg

II. The authority and attribution of the directory

1. Access rights

2. Ownership (ownership)

Owner: the user account that owns this directory

Group: the group account that owns this directory

3. Chmod sets directory permissions

The basic format for setting directory permissions by the chmod command is as follows:

Application examples:

[root@centos01] # chmod-R 755 benet/ [root@centos01] # ll total amount 8MhrwMuthxrw1 root root January 11 22:27 1.txtMuyrwyr. 1 root root 1572 October 23 22:37 anaconda-ks.cfgdrwxr-xr-x 3 root root 18 January 11 22:39 benet-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg

4. Attribution of chown setting directory

The chown command sets the basic format for directory attribution as follows:

Application examples:

[root@centos01] # chown-R bob:benet benet/ [root@centos01] # ll total consumption 8murrwMuhrwxrw1 root root January 11 22:27 1.txtMurray RWL. 1 root root 1572 October 23 22:37 anaconda-ks.cfgdrwxr-xr-x 3 bob benet 18 January 11 22:39 benet-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg

3. Permission mask umask

1. The function of umask

Control the permissions of the newly created file or directory. The default permission to remove the permission of umask is the permission of the newly created file or directory.

2. Set umask

Umask 022

3. View umask

Umask

4. Application examples:

[root@centos01 ~] # umask 0022 [root@centos01 ~] # umask 0022 [root@centos01 ~] # umask 0000 [root@centos01 ~] # touch 2.txt [root@centos01 ~] # ll Total usage 8-rwxr-xr-x 1 bob benet 0 January 17 03:48 1.txt RW 8-rwxr-xr-x RW RW-1 root root January 17 03:48 2.txt-rw-. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg [root@centos01 ~] # umask 022 [root@centos01 ~] # umask 0022 [root@centos01 ~] # touch 3.txt [root@centos01 ~] # ll Total usage 8-rwxr-xr-x 1 bob benet January 17 03:48 1.txtkowitz RWMuir RW-1 root root January 17 03:48 2.txtMuk RWMui RWMui-1 root root January 17 03:49 3.txt-rw-. 1 root root 1572 October 23 22:37 anaconda-ks.cfg-rw-r--r--. 1 root root 1603 October 23 23:36 initial-setup-ks.cfg

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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