To add user user1 (uid=550 gid=550) as an example:
To enter the shell with the administrator root account:
#vi/etc/group
At the end, add by format:
USER1:X:550:
#wq
#vi/etc/passwd
Add at the end:
User1:x:550:550::/home/user1:/bin/bash
#wq
#vi/etc/shadow
Add at the end:
user1:!! : 16875:0:99999:7:::
(The meaning of one of the fields:
1
)“登录名”是与/etc/passwd文件中的登录名相一致的用户账号
2
)“口令”字段存放的是加密后的用户口令字,长度为
13
个字符。如果为空,则对应用户没有口令,登录时不需要口令;如果含有不属于集合{./
0
-9A-Za-z}中的字符,则对应的用户不能登录。
3
)“最后一次修改时间”表示的是从某个时刻起,到用户最后一次修改口令时的天数。时间起点对不同的系统可能不一样。例如在SCOLinux中,这个时间起点是
1970
年
1
月
1
日。
4
)“最小时间间隔”指的是两次修改口令之间所需的最小天数。
5
)“最大时间间隔”指的是口令保持有效的最大天数。
6
)“警告时间”字段表示的是从系统开始警告用户到用户密码正式失效之间的天数。
7
)“不活动时间”表示的是用户没有登录活动但账号仍能保持有效的最大天数。
8
)“失效时间”字段给出的是一个绝对的天数,如果使用了这个字段,那么就给出相应账号的生存期。期满后,该账号就不再是一个合法的账号,也就不能再用来登录了。)
#wq!
#cp-R/etc/skel/home/user1
#chown-R User1.user1/home/user1
#chmod-R go=/home/user1
#openssl passwd-1-salt "87548548"
Enter a password and then generate a string of characters to copy this string of characters
#vi/etc/shadow
On the line that you just joined user1:!! : 16875:0:99999:7::: In, remove!!
Then paste this string of characters. Save Shadow is created.
Linux manually add a regular user