Linux User creation Command Useradd

Source: Internet
Author: User
Tags create directory

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.