Day 1 of DevOps 100 Days

Hello Everyone,

I am going to start #100days of DevOps journey where I will try to solve at least one question everyday of a project and will document it.

This will help me be consistent in practice and sharpen my knowledge.

I will discuss the problem here which I solved taking from different platform as reference so if you are hardcore DevOps and Cloud enthusiast you may find similar question or concept.

So, Now let’s discuss the very first question.

Q: 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 javed with a non-interactive shell on App Server 2.

Discussion:

As from the question we can get that this is a Linux User Creation based question. If you have worked as System Admin or have good knowledge with Linux this will be eassy pesssy question to you.

If not……….No worries let’s do it together

Note : This problem is taken from KodeKloud do explore it.

Steps to Create the User with a Non-Interactive Shell:

First Connect to App Server 2 -

ssh your_user@stapp02

Switch to Root :

sudo su -

(Enter your password if prompted.) (I have taken the password from KodeKloud manual)

Create the User javed with /sbin/nologin Shell:

useradd -s /sbin/nologin javed

-s /sbin/nologin —> Ensures the user can not log in interactively.

Verify the User:

grep javed /etc/passwd

Expected Output should be there in form of

javed:x:<UID>:<GID>::/home/javed:/sbin/nologin

(This confirms the user was created with the correct shell.)

Set a Password (if needed for backup agent)

  • If the backup tool requires authentication, set a password:

  •   echo "javed:your_password" | chpasswd
    

    (Replace your_password with a secure password.)

  • Why /sbin/nologin?

    • Prevents interactive login (SSH, console, etc.).

    • Allows system services (like backup agents) to use the account.

Final Check

    id javed

Output:

  •   uid=1002(javed) gid=1002(javed) groups=1002(javed)
    

    (Confirms the user exists.)

  • Troubleshooting

    • If useradd fails, ensure you have sudo privileges.

    • If /sbin/nologin doesn’t exist, check alternatives like /bin/false.

0
Subscribe to my newsletter

Read articles from Kunal Kumar Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kunal Kumar Singh
Kunal Kumar Singh

I am a DevOps Engineer working in MNC. Where I automate Infrastructure using various DevOps tools and AWS Cloud.