1 在/etc/group加一行用户组信息
echo ''student:x:501:'' >> /etc/group
2 在/etc/passwd 加一行用户信息
echo ''student:x:501:501::/home/student:/bin/bash'' >> /etc/passwd
3 在/home下建立用户目录,并更改权限
mkdir /home/student
chown student:student /home/student
4 在/etc/shadow加一行密码相关信息
chmod w /etc/shadow
grub-md5-crypt
echo ''student:$aldfjeladf:14524:0:99999:7:::'' >> /etc/shadow
chmod -w /etc/shadow
5 复制模版文件
cp -f /etc/skel/* /home/student
6 更改目录权限
chmod 700 /home/student
======================================================================
加用户组
echo ''teacher:x:550:''>>/etc/group
同步
grpconv
加用户密码
echo ''teacher:x:550:550::/home/teacher:/bin/bash''>>/etc/passwd
同步
pwconv
建立家目录
cp -r /etc/skel /home/teacher
更改属主属组
chown teacher:teacher /home/teacher
更改权限
chmod 700 /home/teacher
更新密码
passwd teacher |