Thursday, August 07, 2025
Day - 01 | 100 Days of DevOps Challenge by KodeKloud
A summary of Day 1 of the 100 Days of DevOps Challenge by KodeKloud
Sabbir Ahmed
Day - 01 | DevOps Challenges
Task Statement
Create a user named sabbir with a non-interactive shell on App Server X.
Solution
To complete this task, you need to create a new user called sabbir
and assign a non-interactive shell (such as /sbin/nologin
) so the user cannot log in interactively.
Step-by-step Solution
-
Login to App Server X
Use SSH to connect to the server:ssh user@app-server-x
-
Create the User with Non-interactive Shell
Run the following command:sudo useradd -s /sbin/nologin sabbir
-
Verify the User and Shell
Check the user entry in/etc/passwd
:grep sabbir /etc/passwd or getent passwd sabbir
You should see something like:
sabbir:x:1001:1001::/home/sabbir:/sbin/nologin
Explanation
- The
useradd
command creates a new user. - The
-s /sbin/nologin
option sets the shell to a non-interactive shell, preventing direct login. - This is a common practice for service accounts or users that should not have shell access.
Example Use Case for non-interactive user
Suppose you want to run a web server (like nginx) under a dedicated user account for security reasons. You do not want this user to have shell access.
You can create the user like this:
sudo useradd -r -s /sbin/nologin nginx
Here
-r
creates a system account.-s /sbin/nologin
prevents interactive login.
This way, the nginx
user can run the web server process, own files, and perform necessary tasks, but cannot log in to the system interactively.
Interactive Shell Example (/bin/bash
)
If you want to create a user with interactive shell access, use /bin/bash
:
sudo useradd -s /bin/bash username
This allows the user to log in and interact with the system normally.
Reflection
This task introduces basic Linux user management, which is a fundamental skill in DevOps. Understanding how to control user access is crucial for maintaining security and proper server administration.
Next Steps
- Explore more user management commands (
usermod
,passwd
,deluser
). - Learn about different shell options and their implications.
- Continue with Day 2 of the challenge!
Stay tuned for more daily updates on the 100 Days of DevOps Challenge!