useradd Command:
命令格式:useradd 用户名 参数 常用参数: -m 创建用户时创建用户目录 -d 创建用户时指定用户登陆时的目录 -c 创建用户时备注用户信息在/etc/passwd可以看见 -e 指定账号的有效期限,缺省表示永久有效 -f 指定在密码过期后多少天即关闭该账号、 -g 指定用户组 -n 取消建立以用户名称为名的群组 -r 建立系统账号、 -s 指定用户登陆后使用shell -u 指定用户id号 -U 创建与用户同名的组
The Useradd command uses:
useradd 11-m-d/home/root Create a 11 user does not create directory the directory specified by the user is the root directory [[email protected] ~]# useradd 11-m-d/home/root [[email protected] ~]# cat/etc/passwd |grep ^11 11:x:1005:1005::/home/root:/bin/bash You can see the 11 used in the passwd file The directory where the user is logged in is root to create a UID of 503 users (the UID number is preferably more than 500 because 0-499 is the system default UID, it is best not to create user uid less than 499 to avoid conflict) [[email ;p rotected] ~]# useradd 22-u 503 [[email protected] ~]# cat/etc/passwd |grep ^22 22:x:503:1006::/home/22:/bin/bash creates a user with a group of User1 and this user belongs to another group (root) and requires that the shell not be used [[email protected] ~]# useradd 33-g user1-g root-s/sbin/nologin [[ Email protected] ~]# cat/etc/passwd |grep ^33 33:x:1006:1007::/home/33:/sbin/nol Ogin
Linux User creation command Useradd