100-Days-Of-DevOps-Challenge-KodeKloud

Day 001: Linux User Setup with Non-interactive Shell

Difficulty: 🟒 Beginner Time: 10 minutes Category: Linux Administration

🎯 Objective

Create a user with non-interactive shell for your organization on a specific server. This is essential for service accounts and automated processes that don’t require interactive login capabilities.

πŸ“‹ Prerequisites

πŸ”§ Technologies Used

Steps

  1. First, login into the app server using SSH:

     ssh user@app-server-ip
    

    It will ask for user password, enter the correct password.

  2. After login into server, run the following command to create user with non-interactive shell

     sudo useradd -m -s /usr/sbin/nologin user-name
    

    s: for shell, here we are giving nologin shell

    m: for user home directory, It will create a directory with user-name under /home

  3. Verify the result

     cat /etc/passwd
    

    It should give you a list of users where you will find your created user. It will look like this: kareem:x:1003:1004::/home/kareem:/usr/sbin/nologin

    Try to login using:

     sudo su user-name
    

    Output: This account is currently not available.

Verification & Troubleshooting

Common Issues

Additional Commands

# List all users with nologin shell
grep nologin /etc/passwd

# Check user details
id username

# Remove user if needed
sudo userdel -r username

Key Takeaways

Good to Know?

Linux User Management

useradd Command Options

Security Best Practices

Next Challenge: Day 002 - Temporary User Setup