Ubuntu10.04useradd and adduser

Source: Internet
Author: User
The usage of ubuntu10.04useradd and adduser has never been clear about the difference between useradd and adduser in ubuntu. Most posts on the Internet say that the two are actually implementing the same function, but when I am doing it myself, there are a lot of problems. now I will write a memo after summing up ,... the usage of useradd and adduser in ubuntu 10.04 has never been clear about the difference between useradd and adduser in ubuntu. Most posts on the Internet say that the two are actually implementing the same function, but I have a lot of problems when I am doing it myself. now I will write a memo after the conclusion, so let's take a look. Useradd is a linux command, but it provides many parameters for users to set according to their own needs. adduser is a perl script, the interface similar to man-machine interaction is displayed when you use it. It provides options for users to fill in and select. This command is simpler and dummies than useradd. I. details about adduser use www.2cto.com when using the adduser command, the system will add this user name and automatically create a user group with the same name as this user name as the initial user group of this user. In addition, a directory with the same name as the user is automatically created under the/home directory, and then the "cp/etc/skel/home/username" operation is executed, initialize the main directory of the new user.

The account created using the adduser command is a system account and can be used to log on to our ubuntu system.
II. useradd has a large number of parameters for personalized settings. However, we do not know many default settings, you need to be cautious and careful when selecting this parameter. Otherwise, the result may be different from what we expected. The useradd parameter is as follows:-c remarks and remarks. The remarks are added to the-d main folder in the 5th Field of/etc/passwd. Specify the directory to which the user logs on and give the user full control over the Directory-e validity period. The validity period of the specified account. The format is YYYY-MM-DD, which will be stored in/etc/shadow-f buffer days. Set the number of days after the password expires to disable the main g Group of the user account. Set the main group www.2cto.com-G secondary group to which the user belongs. Set the secondary group to which the user belongs. you can set multiple groups-M to force creation of user Master folders without creating user Master folders-m to force creation of user Master folders, and copy the files in/etc/skel/to the user's root directory-p password. Enter the account password-s shell. The shell-u uid used for user logon. User id, uid for short
The useradd command creates a common account and cannot be used to log on to the system. Note: In fact, when I use useradd, there are still many problems. The most impressive thing is that even if I use the "-d" parameter, the user's main folder cannot be correctly created. Later, I directly used the "-m" parameter to force the creation of the user's main folder, instead of the "-d" parameter. as a result, the main folder was created. So I came to the conclusion that when the "-m" parameter is used, the system will automatically create a main user folder with the same name as the new user in the/home directory; if "-m" is not used, the "-M" parameter is used by default, and the main folder is not created, even if you use the "-d" parameter. Therefore, the "-d" parameter is used with "-m" to allow you to select the path of the main folder. Prepared by AI_Net
Related Article

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.