Step by step approach of Linux task on creating a user by the KodeKloud Engineer Program:

Step by step approach of Linux task on creating a user by the KodeKloud Engineer Program:

Task:

a. Create a user named anita on the App server 3 in Stratos Datacenter.
b. Set its UID to 1273 and home directory to /var/www/anita.

Checkout this task's video here: https://youtu.be/y1h5dfqMU5Q

Step 1: Connect to App Server 3

  1. SSH into App Server 3: Replace username with your user name on App Server 3 and app_server_3_ip with the server's IP address or hostname.

     sudo ssh username@app_server_3_ip
    

    Enter your password to proceed.

Step 2: Switch to Root User

  1. Root access is required for elevated privileges to execute sensitive commands.

     sudo su -
    

    (Enter your password )

Step 3: Create the User with a Specific UID

  1. Create a new user with the specified UID (1550):

     useradd -u 1273 anita
    
    • This command creates a new user named 'anita' with the User ID (UID) of 1273.

Step 4: Create the Home Directory

  1. Create the home directory for the user:

     mkdir -p /var/www/anita
    
    • The -p flag ensures that the mkdir command creates the necessary parent directories /var/www if they don't already exist.

Step 5: Assign the Home Directory to the User

  1. Assign the newly created directory as the user's home directory:

     usermod -d /var/www/anita anita
    
    • This command modifies the user 'anita' to have a home directory at /var/www/anita.

Step 6: Verify the User Creation

  1. Check the details of the newly created user account:

     id anita
    
    • This command will display the user information including UID and groups.