User, user group related exercises-3

Source: Internet
Author: User

1, create user Gentoo, additional group is bin and root, default shell is/bin/csh, annotation information is "gentoodistribution"

[Email protected] ~]# useradd-g bin,root-s/bin/csh-c "Gentoo distribution" Gentoo

2. create the following user, group, and group memberships

A group with a name of admins

[[Email protected] ~] #groupadd Admins

user Natasha, using Admins as a subordinate group

[[Email protected] ~] #useradd –G Admins Natasha

user Harry , also use admins as a subordinate group

[[Email protected] ~] #useradd –G Admins Harry

user Sarah , cannot log on to the system interactively, and is not a member of admins,

[Email protected]~] #useradd –s/sbin/nologin Sarah

User Natasha ,Harry , Sarah,the code's all CentOS.

[Email protected]~] #passwd Natasah

3, the new files created in the/data/testdir automatically belong to the G1 Group, the group G2 members such as:Alice can have read and write access to these new files, the group G3 Members such as:Tom can only have read access to the new file, other users (not belonging to g1,g2,g3 ) cannot access this folder

[[email protected] ~]# mkdir-p/data/testdir Note that the data directory is in the root directory, not in the current home directory

[Email protected] data]# chown G1 TestDir

[Email protected] data]# chmod g+s TestDir

[Email protected] data]# useradd-g G2 Alice

[Email protected] data]# SETFAC l-m d:g:g2:rwx TestDir

[Email protected] data]# useradd-g G3 Tom

[Email protected] data]# SETFAC l-m d:g:g3:rx TestDir

[[email protected] data]# chmod o= testdir not only can not be cut in, and can not view the contents of the file list information


User, user group related exercises-3

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.