Details about useradd and adduser in CentOS and Ubuntu

Source: Internet
Author: User
I have written an article about the commands "adduser" and "useradd" for creating a new user in Ubuntu10.04 ". URL: Workshop. At that time, I also spoke about the disorderly online articles. Now, after my own experiments, I found that

I have written an article about the commands "adduser" and "useradd" for creating a new user in Ubuntu 10.04 ". Web: http://www.linuxidc.com/Linux/2012-06/63043.htm

In fact, many articles on the Internet said that these two commands actually have the same effect, but I found that they are not the same when I tried them on Ubuntu 10.04. At that time, I also spoke about the disorderly online articles. Now, after my own experiments, I found that the two commands in different versions of Linux are not exactly the same. I compared CentOS with Ubuntu.

First, let's take a look at the CentOS directory and run the command

[Root @ localhost sbin] # ll | grep useradd

The following result is displayed:

Observe the first and third items in the above results. We can find that the original adduser is linked to useradd. Therefore, in Centos, useradd and adduser have the same functions. After a user is created, a new user record is added to the/etc/passwd file, and the home directory of the new user is created under the/home directory, copy the files in the/etc/skel directory to the directory.

Note: New users created in this method cannot log on to the system before setting the password, you need to use the "passwd User Name" method under the root permission to set a password for the specified user. You can log on to the system with the user name and password next time.

Next, let's take a look at the ubuntu system, first go to the/usr/sbin directory and use the command

[Root @ localhost sbin] # ll | grep useradd

The following result is displayed:

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.