banner



How To Create User In Ubuntu Command Line

totn Linux


Linux: How to Create a User in Ubuntu Linux Server 14.04 LTS

In this Linux system administration tutorial you will learn how to create a user on an Ubuntu Linux Server 14.04 LTS (Trusty Tahr) system with screenshots and instructions.

Description

System administrators create user accounts to allow access to the system or system services. To add a new user, you will use the useradd command.

Syntax

The syntax for the useradd command is:

useradd -u User_ID -g Group [-d Directory_Path] [-m] [-c "Full_User_Name"] User_Name

Prerequisites

The useradd command requires the following parameters:

-u User_ID
The -u parameter indicates that a user number will follow. This is the user number that will be assigned to this new user. The user number must be unique.
-g Group
The -g parameter indicates that a group number will follow. This can be either a group ID or group name that the user should be assigned to.
-d Directory_Path
Optional. The -d parameter sets the location of the user's home directory as specified by Directory_Path. Setting the home directory does not guarantee that the directory exists (see the -m parameter).
-m
Optional. The -m parameter creates the user's home directory if it does not already exist.
-c "Full_User_Name"
Optional. This is an optional comment field but is generally used to hold the user's full name so the account can easily be identified. The Full_User_Name must be wrapped in quotations if it contains spaces.
User_Name
The user name of the account you would like to add. This must be unique and will be the account name that is used to log in.

NOTE: In this tutorial we will not be specifiying the -d parameter. This tells the system to use the default directory path of /home/User_Name for the home directory.

Prerequisites

To complete this tutorial you will require a running Ubuntu Linux Server 14.04 LTS system and an account with sudo administrative privileges. The sudo command is used to provide the superuser privileges required for the useradd command.

Create a User

The following steps will guide you through creating a user on an Ubuntu Linux Server 14.04 LTS system.

  1. To begin adding a new user to your system, you will need to be logged in using a valid user account for your system. If you are unsure of how to do this, read our tutorial on Logging into Ubuntu Linux Server 14.04 LTS.

    In this tutorial, we have logged in as techonthenet on the host called ubuntu.

  2. We will add a new user called jsmith which has a User ID of 10000, a home directory of /home/jsmith and is a member of the group called students which has a Group ID of 10000.

    To add the user called jsmith, we would enter the following command:

    sudo useradd -u 10000 -g 10000 -m -c "Jim Smith" jsmith

    The following screenshot demonstrates what you will see.

    Add user

    When you have entered the command, press the Enter key to execute the command.

  3. The sudo command will now prompt you to enter the password for your administrator account.

    Enter sudo password

    Please note that no characters will show as you type your password. This is normal and is important to preserve the security of your password.

    After you have entered your password, press the Enter key to continue.

  4. If all goes well, you will see the system prompt appear again without any errors. This indicates that the new user called jsmith has been added successfully.

    After user added

  5. In this step we will check to ensure that the new user called jsmith was added to the system. Since new users are added to the end of the system passwd file called /etc/passwd, we can use the tail command to verify that the new user was added.

    Enter the following tail command after the system prompt to show the last few lines of the system passwd file:

    sudo tail /etc/passwd

    The following screenshot demonstrates what the command will look like after it is typed.

    Tail passwd file

    When you have entered the command, press the Enter key to execute the command.

  6. As seen in the screenshot below, the following line appears at the end of the /etc/passwd file indicating that the jsmith user was created.

    jsmith:x:10000:10000:Jim Smith:/home/jsmith:

    Confirm user added

  7. After creating a new user it is very important to assign a password to the new account. To set a password for the jsmith account enter the following command after the system prompt:

    sudo passwd jsmith

    The command will look like the following:

    Set user password

    When you have entered the command, press the Enter key to execute the command.

  8. The passwd command will now prompt you to enter the password you would like to associate with the jsmith account.

    Enter user password

    Enter the password and press the Enter key when done.

  9. The passwd command will now prompt you to re-enter the password to ensure that the passwords match.

    Re-enter user password

    Re-enter the password and press the Enter key when done.

  10. If all goes well, you will see the following line appear as it does in the screenshot below:

    passwd: password updated successfully

    This indicates that the password was successfully changed.

    User password set

    Congratulations, you have successfully added a new user to your Ubuntu Linux Server 14.04 LTS system!

How To Create User In Ubuntu Command Line

Source: https://www.techonthenet.com/linux/sysadmin/ubuntu/create_user_14_04.php

Posted by: terrellsuaing.blogspot.com

0 Response to "How To Create User In Ubuntu Command Line"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel