作业8月2日
1、创建testuser uid:1234,主组:bin,辅助组:root,ftp,shell:/bin/csh,home:/testdir/testuser
groupadd ftp
useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser
2、修改testuser uid:4321,主组:root,辅助组:nobody,loginname:text,home:/home/test
groupadd nobody
usermod -u 4321 -g root -G nobody -md home/test -l test testuser
3、批量创建账号:user1..user10,uid:3000-3009,shell:/bin/csh,home:/testdir/username,passwd:usernamepass。注意家目录相关配置,使用户正常登陆。
nano txt.sh
user1:x:3000:3000::/testdir/username1:/bin/csh/
user2:x:3001:3001::/testdir/username2:/bin/csh/
user3:x:3002:3002::/testdir/username3:/bin/csh/
user4:x:3003:3003::/testdir/username4:/bin/csh/
user5:x:3004:3004::/testdir/username5:/bin/csh/
user6:x:3005:3005::/testdir/username6:/bin/csh/
user7:x:3006:3006::/testdir/username7:/bin/csh/
user8:x:3007:3007::/testdir/username8:/bin/csh/
user9:x:3008:3008::/testdir/username9:/bin/csh/
user10:x:3009:3009::/testdir/username10:/bin/csh/
newusers txt.sh
getent passwd
nano mima
username1:usernamepass
username2:usernamepass
username3:usernamepass
username4:usernamepass
username5:usernamepass
username6:usernamepass
username7:usernamepass
username8:usernamepass
username9:usernamepass
username10:usernamepass
cat mima | chpasswd
getent shadow
cp -r /etc/skel/.[^.]* /testdir/username1
cp -r /etc/skel/.[^.]* /testdir/username2
cp -r /etc/skel/.[^.]* /testdir/username3
cp -r /etc/skel/.[^.]* /testdir/username4
cp -r /etc/skel/.[^.]* /testdir/username5
cp -r /etc/skel/.[^.]* /testdir/username6
cp -r /etc/skel/.[^.]* /testdir/username7
cp -r /etc/skel/.[^.]* /testdir/username8
cp -r /etc/skel/.[^.]* /testdir/username9
cp -r /etc/skel/.[^.]* /testdir/username10