Create a user in ubuntu

Source: Internet
Author: User

The new user in ubuntu is a little different from the RedHat series linux.

The command for creating a user is useradd and the password is passwd, as shown below:

sudo useradd zhuhuisudo passwd  123456
However, the error occurs. The home Directory does not have the corresponding zhuhui directory.
Ubuntu didn't do that much for us. Let's take a look at the options of useradd:
Option:-B, -- base-dir BASE_DIR the base Directory of the home directory of the new account-c, -- comment COMMENT GECOS field of the new account-d, -- home-dir HOME_DIR the main directory of the new account-D, -- defaults displays or changes the default useradd configuration-e, -- expiredate EXPIRE_DATE the expiration date of the new account-f, -- inactive INACTIVE the password of the new account is not active-g, -- Name of the master GROUP of the new account in gid GROUP or ID-G, -- Additional GROUP list of the new account in groups GROUP-h, -- help displays this help information and releases-k, -- skel SKEL_DIR uses this directory as the skeleton directory-K, -- key KEY = VALUE does not use/etc/login. the default value-l, -- no-log-init in defs should not add this user to the database of recent logon and logon Failure-m, -- create-home to create the user's home directory-M, -- no-create-home does not create the user's home directory-N, -- no-user-group does not create a group with the same name-o, -- non-unique allows duplicate UID to create user-p, -- password PASSWORD Encrypted new account password-r, -- system to create a system account-s, -- shell SHELL New Account Login shell-u, -- uid UID new account user ID-U, -- user-group to create a group with the same name as the user-Z, -- selinux-user SEUSER: SELinux user ing using the specified SEUSER
We need to build a user's home directory and shell by ourselves, as shown below:
Userdel-r zhuhui # Delete the three uncreated useradd linc-m-s/bin/bashpasswd zhuhui
OK. You can also use the adduser command to create a user, which is more like a human-machine conversation. The system will prompt you to enter various information and then help you create a new user based on the information.

Note that the created "zhuhui" user does not have the sudo permission. How can this problem be solved for general users. Refer to the article in this blog: How to grant sudo permissions to common users in ubuntu?

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: info-contact@alibabacloud.com 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.