Sixth chapter user and Rights Management

Source: Internet
Author: User

One, the order

1. Adding or deleting users

Useradd A1 New User A1 cat/etc/passwd system reserved uid 0-99,0 as root, new user starting from 500

Userdel-r Deleting a user

Usermod-l Lock User

Usermod-u Unlocking

Note: When we normally set up the user through Useradd A1 (no password is set at this time, the user A1 cannot log on to the system), we see Cat/etc/shadow can see the password as! , *,x indicates that this user is unable to log on

[Email protected] tmp]# Useradd A1

[Email protected] tmp]# Cat/etc/shadow

Root:$6$xonoi4go0ywzh2dd$mhmeqm/mpc7xncyiymrdgrp3xohvang74lycavj1lrcwn9yzqtdvcw3xzdvql. 4c10v6yvkjgtr0jlibbqbo1:17122:0:99999:7:::

Bin:*:15980:0:99999:7:::

Daemon:*:15980:0:99999:7:::

Adm:*:15980:0:99999:7:::

Lp:*:15980:0:99999:7:::

Sync:*:15980:0:99999:7:::

Shutdown:*:15980:0:99999:7:::

Halt:*:15980:0:99999:7:::

Mail:*:15980:0:99999:7:::

Uucp:*:15980:0:99999:7:::

Operator:*:15980:0:99999:7:::

Games:*:15980:0:99999:7:::

Gopher:*:15980:0:99999:7:::

Ftp:*:15980:0:99999:7:::

Nobody:*:15980:0:99999:7:::

dbus:!! : 17122::::::

Rpc:!! : 17122:0:99999:7:::

vcsa:!! : 17122::::::

abrt:!! : 17122::::::

saslauth:!! : 17122::::::

postfix:!! : 17122::::::

haldaemon:!! : 17122::::::

Ntp:!! : 17122::::::

Apache:!! : 17122::::::

rpcuser:!! : 17122::::::

nfsnobody:!! : 17122::::::

Sshd:!! : 17122::::::

tcpdump:!! : 17122::::::

C2:$6$u0l.la3u$iclu6lk0ydg93c.g7udffr88ahoutq5k/bkjt90mwynj4tsyyh8tdnskhmyigqjsrify6mwdw6h/azcayeu3r0 : 17135:0:99999:7:::

C3:$6$vh1ki1gi$tpmm0rlfyea/ss3jlg408pwswnqn4ved0vuz4xvkj5i6qwg50rrqhk8ixrtsynjm8bsutrrl9bgdof/qmnwbi. : 17135:0:99999:7:::

A1: ! : 17135:0:99999:7:::


2, the management of the group

GROUPADD-G market set up and manually set the GID to 1000

Groupdel Market Delete Group Market


GPASSWD-A A1 Market Add user A1 to group market

GPASSWD-D A1 Market Remove user A1 from Group market


GPASSWD-A A1 Market The user is set as the administrator of the group market


3. Change file Permissions chmod

[email protected] tmp]# Touch test.txt

[Email protected] tmp]# LS-LAIHS

Total 24K

261633 4.0K DRWXRWXRWT. 5 root root 4.0K Nov 30 18:35.

2 4.0K dr-xr-xr-x. Root root 4.0K Nov 17 16:06.

266164 4.0K drwxr-xr-x. 2 root root 4.0K Nov 15:27 AAA

262057 4.0k-rwxrwx---. 1 root c1group 18:18 gongxiang.txt

261872 4.0K DRWXRWXRWT. 2 root root 4.0K Nov 17 16:06. Ice-unix

262063 0-rw-r--r--. 1 root root 0 Nov 18:35 test.txt

261873 4.0K drwxr-xr-x. 5 root root 4.0K 05:34 Vmware-tools-distrib

[Email protected] tmp]# chmod 775 test.txt

[Email protected] tmp]# LS-LAIHS

Total 24K

261633 4.0K DRWXRWXRWT. 5 root root 4.0K Nov 30 18:35.

2 4.0K dr-xr-xr-x. Root root 4.0K Nov 17 16:06.

266164 4.0K drwxr-xr-x. 2 root root 4.0K Nov 15:27 AAA

262057 4.0k-rwxrwx---. 1 root c1group 18:18 gongxiang.txt

261872 4.0K DRWXRWXRWT. 2 root root 4.0K Nov 17 16:06. Ice-unix

262063 0-rwxrwxr-x. 1 root root 0 Nov 18:35 test.txt

261873 4.0K drwxr-xr-x. 5 root root 4.0K 05:34 Vmware-tools-distrib

4. Change the owner or group of the file or directory

Chown:c1group Share.txt changed the Share.txt file group to C1group

Chown c2:c1group 111.txt Change 111.txt file owner to C2, belong to group C1group


5. Setfacl can also be defined using ACL rules

Setfacl-m stu:rwx Hello_world Let the user stu have rwx permissions

Setfacl-m G:student:rx Hello_world Let the group student have RWX permissions

Setfacl-x g:student hello_world release student group permissions to files


This article is from the "Asteroid" blog, please be sure to keep this source http://3203180.blog.51cto.com/3193180/1878261

Sixth chapter user and Rights Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.