1,创建testuser uid 1234,主组:bin,辅助组:root,ftp,shell:/bin/csh home:/testdir/testuser
useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser
2.修改testuser uid:4321,主组:root,辅助组:nobody,name:test,home:/home/test 家数据迁移
usermod -u 4321 -g root -G nobody -l test -d /home/test -m testuser
3.批量创建帐号:user1…user10
uid:3000-3009,shell:/bin/csh,home:/testdir/username
passwd:usernamepass
注意家目录相关配置,使用户正常登录
vi user.txt
user1:x:3000:3000::/testdir/username:/bin/csh
user2:x:3001:3001::/testdir/username:/bin/csh
user3:x:3002:3002::/testdir/username:/bin/csh
user4:x:3003:3003::/testdir/username:/bin/csh
user5:x:3004:3004::/testdir/username:/bin/csh
user6:x:3005:3005::/testdir/username:/bin/csh
user7:x:3006:3006::/testdir/username:/bin/csh
user8:x:3007:3007::/testdir/username:/bin/csh
user9:x:3008:3008::/testdir/username:/bin/csh
user10:x:3009:3009::/testdir/username:/bin/csh
newusers user.txt
vi p.txt
user1:usernamepass
user2:usernamepass
user3:usernamepass
user3:usernamepass
user4:usernamepass
user5:usernamepass
user6:usernamepass
user7:usernamepass
user8:usernamepass
user9:usernamepass
user10:usernamepass
cat p.txt |chpasswd
cp -r /etc/sk1/.[^.]* /testdir/username/user1
cp -r /etc/sk1/.[^.]* /testdir/username/user2
cp -r /etc/sk1/.[^.]* /testdir/username/user3
cp -r /etc/sk1/.[^.]* /testdir/username/user4
cp -r /etc/sk1/.[^.]* /testdir/username/user5
cp -r /etc/sk1/.[^.]* /testdir/username/user6
cp -r /etc/sk1/.[^.]* /testdir/username/user7
cp -r /etc/sk1/.[^.]* /testdir/username/user8
cp -r /etc/sk1/.[^.]* /testdir/username/user9
cp -r /etc/sk1/.[^.]* /testdir/username/user10
原创文章,作者:swzczx,如若转载,请注明出处:http://www.178linux.com/28279