Differences between useradd and adduser in Ubuntu

Source: Internet
Author: User

To create a user in Ubuntu, two commands are usually used: useradd and adduser. Although they have the same functions, their usage is different. This article will give readers a detailed explanation.

AD: 51CTO School: Excellent IT courses are available online!

 

InUbuntuTo create a user, two commands are usually used:UseraddAndAdduser. Although the function is the same, the usage is different:

1. when useradd is used, if no Parameter options are added later, for example: # The user created by sudo useradd test is the default "Three none" User: one has no Home Directory, and the other has no password, 3. No system Shell.

2. When adduser is used, the user creation process is more like a human-machine conversation. The system will prompt you to enter various information and then help you create new users based on the information.

Useradd is an ELF executable program;

Useradd adds a user name and creates a group name that is the same as the user name. However, it does not create a user name-based directory in the/home directory, nor prompts you to create a new password.

-B,-base-dir BASE_DIR specifies the base Directory of the home Directory

-D,-home-dir HOME_DIR specifies the home Directory

-G,-gid GROUP specifies gid

-L,-no-log-init do not add the user to the lastlog and

Faillog databases

Do not add a user to lastlog or failog. This user's logon record does not need to be recorded.

-M,-no-create-home do not create the home Directory

-P,-password PASSWORD specifies the password of the new user

-R,-system: Create a system account

-S,-shell SHELL specifies shell

Adduser-m-d/usr/system-s/bin/bash-p passwd system

Adduser is a perl script that allows you to set user parameters interactively.

Problem:

The-p Parameter of adduser cannot be shadow password

The parameters of/usr/sbin/usermod and useradd are similar.

Usermod-password PASSWORD username

In summary, in Ubuntu, adduser is more suitable for beginners, because you do not need to remember the cumbersome Parameter options, as long as you follow the system prompts to proceed step by step, the disadvantage is that the entire creation process is complicated and long. useradd is suitable for users with some high-level experience. It is very convenient to create a line of commands and parameters.

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.