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