Job Requirements
use the learned knowledge to complete classroom exercises and after-school assignments
Classroom Exercises
1. Create the user Gentoo, the additional group is bin and root, the default shell is/bin/csh, the annotation information is "Gentoo distribution"
Thinking : The main option is to examine useradd.
- g,--groups group1[,group2,... [, GROUPN]] Join the specified group (the group must exist)
- s,--Shell shell specifies the default shell
- C,--comment Comment User's full name or comment
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/85/4A/wKiom1efMDXB_7IiAAAh-Q5nlpI807.png "title=" Image 20160801191712.png "alt=" Wkiom1efmdxb_7iiaaah-q5nlpi807.png "height=" "width=" 701 "/> "
2. Create the following user, group, and group memberships
-
name admins
User Natasha , using Admins as a subordinate group
user Harry, also use admins as a subordinate group
-
user Sarah, no interactive login system, and not admins Member of
Natasha, Harry, Sarah, the code's all CentOS.
think: Simple to create groups, users.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/85/4A/wKioL1efMcbTe4F8AABJrnW-yWw468.png "title=" Image 20160801192603.png "alt=" Wkiol1efmcbte4f8aabjrnw-yww468.png "/>
homework after class
1. create testuser UID 1234, primary Group: Bin, Auxiliary Group: ROOT,FTP,SHELL:/BIN/CSH Home:/testdir/testuser
thinking: Mainly familiar with useradd options,-D to specify the directory, the first to determine the existence of its parent directory
-C,--comment comment Add user's full name or comment
-D,--home-dir home_dir Specify home directory
-G,--gid Group specifies the primary group
-G,--groups group1[,group2,... [, GROUPN]] Specify additional groups
-U,--uid uid specified UID
-S,--shell shell specifies the default shell
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/85/4B/wKiom1efOJ6gKxk1AAAymTVTvlo956.png "title=" Image 20160801195509.png "alt=" Wkiom1efoj6gkxk1aaaymtvtvlo956.png "height=" 186 "width=" 722 "/>
2. Modify TestUser uid:4321, primary Group: root, Auxiliary Group: Nobody,loginname:test,home:/home/test Home Data Migration
thinking: Mostly familiar options for Usermod
-U,--uid uid specified UID
-G,--gid Group specifies the primary group
-G,--groups group1[,group2,... [, GROUPN]] Specify a secondary group
-D,--home home_dir Specify home directory
-M,--move-home mobile home directory, typically used with-D
- L,--login new_login Specify a new login name
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/85/4C/wKiom1efSQvwkn0cAADHmECSR6s071.png "title=" QQ picture 20160801210515.png "alt=" Wkiom1efsqvwkn0caadhmecsr6s071.png "height=" 326 "width=" 748 "/>
3. Batch Create account: User1...user10
uid:3000-3009,shell:/bin/csh,home:/testdir/username
Passwd:usernamepass
Note Home directory-related configuration, so that users log on normally
thinking: Master NewUsers and chpasswd two commands, but also to confirm that the system is present/BIN/CSH
newusers Command Batch Create users, note that the file is the same as/etc/passwd, we can view the NewUsers man manual:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/85/4F/wKioL1ef8JPAjMDgAABcP2es2OU526.png "title=" QQ picture 20160802085953.png "alt=" wkiol1ef8jpajmdgaabcp2es2ou526.png "height=" 187 "width=" 572 "/>
chpasswd The file content format specified is LOGINNAME:PASSWD, we can also view the CHPASSWD man manual:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/85/4F/wKiom1ef8dahcGQ6AABXuFWMPg0399.png "title=" QQ picture 20160802090444.png "alt=" Wkiom1ef8dahcgq6aabxufwmpg0399.png "height=" 185 "width=" 575 "/>
This batch-created user does not import the default configuration of/etc/skel/, so it needs to be copied to the user's home directory manually .
prepare two texts first:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/4E/wKioL1ef6G7wekcxAAArgsm4f0E977.png "title=" Image 20160802082354.png "alt=" Wkiol1ef6g7wekcxaaargsm4f0e977.png "height=" 345 "width=" 412 "/>
These two commands are simple:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/85/4F/wKioL1ef89zgDppfAAAT7I5zbgM833.png "title=" QQ picture 20160802091406.png "alt=" Wkiol1ef89zgdppfaaat7i5zbgm833.png "/>
Upon completion of execution, we can see that the home directory of each user is not initially configured. We need to manually copy the contents of the/etc/skel/, note : The CP matching source file needs to be noted, if /etc/skel/.* will match /etc/skel/... Causes the entire /etc/* to be copied over.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/85/4F/wKioL1ef9TyBEmZmAABFrTfTTV4747.png "title=" QQ picture 20160802092000.png "alt=" Wkiol1ef9tybemzmaabfrtfttv4747.png "height=" 262 "width=" 385 "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/85/4F/wKioL1ef9vTDRpPeAABMfLfF5I8113.png "title=" QQ picture 20160802092718.png "alt=" Wkiol1ef9vtdrppeaabmflff5i8113.png "height=" 163 "width=" 622 "/>
The UERE2...USER10 also operates in the same way, skipping over here.
Marco Education August 01 Homework