Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.38 KB

Linux User Setup with Non-Interactive Shell.md

File metadata and controls

61 lines (42 loc) · 1.38 KB

Problem Statement

To accommodate the backup agent tool's specifications, the system admin team at xFusionCorp Industries requires the creation of a user with a non-interactive shell. Here's your task:

Create a user named james with a non-interactive shell on App Server 2.

Solution

  1. SSH into the Server:

    • Connect to App Server 2 using SSH.
    ssh steve@stapp02
  2. Switch to the Root User:

    • After connecting, switch to the root user to have the necessary permissions for creating a new user.
    sudo su
  3. Verify the User Doesn't Exist:

    • Check if the user james already exists.
    id james
    id: ‘james’: no such user
  4. Create the User with a Non-Interactive Shell:

    • Use the useradd command to create the user james with the /sbin/nologin shell. This shell prevents the user from logging in interactively.
    useradd james -s /sbin/nologin
  5. Verify User Creation:

    • Check that the user has been created and verify the details.
    id james

    You should see output similar to:

    uid=1002(james) gid=1002(james) groups=1002(james)
    
  6. Verify the User's Shell in /etc/passwd:

    cat /etc/passwd | grep james

    The output should be:

    james:x:1002:1002::/home/james:/sbin/nologin