Securing SSH Root Access — My DevOps Journey, Day 3
One thing I enjoy about the KodeKloud challenges is how they build on the skills I have been learning since Day 1. Each task introduces me to practical Linux administration and shows me how these skills apply in real-wor
One thing I enjoy about the KodeKloud challenges is how they build on the skills I have been learning since Day 1. Each task introduces me to practical Linux administration and shows me how these skills apply in real-world DevOps environments.
Today's task was to disable direct root login through SSH on all application servers in the Stratos Datacenter.
Understanding the Task
SSH (Secure Shell) allows us to connect securely to remote machines and manage them over a network. However, allowing direct SSH access to the root account can increase security risks because root has extensive privileges on the system.
The goal was to disable direct root login while still allowing authorized users to connect using their own accounts.
Steps I Took
1. Connecting to the Server
I used the following command to connect to an application server:
ssh username@hostname
This establishes a remote connection using the specified username and hostname. I repeated the process for each application server.
2. Editing the SSH Configuration
Next, I opened the SSH server configuration file using Vim:
sudo vi /etc/ssh/sshd_config
Inside the file, I located the PermitRootLogin directive and set it to:
PermitRootLogin no
This prevents users from logging in directly as root through SSH.
3. Validating the Configuration
Before restarting the SSH service, I ran:
sudo sshd -t
This checks the SSH server configuration for errors. It is a useful step because it helps identify configuration problems before applying the changes.
4. Restarting the SSH Service
After validating the configuration, I restarted the SSH service:
sudo systemctl restart sshd
This allows the service to apply the updated configuration. Depending on the Linux distribution, the service may be named ssh instead of sshd.
5. Verifying the Changes
Finally, I checked the effective SSH configuration using:
sudo sshd -T | grep permitrootlogin
The expected output was:
permitrootlogin no
This confirmed that the effective configuration disables direct root login through SSH.
What I Learned
Today's challenge helped me understand that system administration is not just about running commands. It is also about understanding what each command does, validating changes before applying them, and verifying that the intended result has been achieved.
I'm gradually becoming more comfortable with Linux security and basic system administration. It's exciting to see how each challenge builds on the previous one and strengthens my DevOps foundation.
Day 3 complete! On to the next challenge. 🚀
Technologies and Concepts
- Linux system administration
- SSH configuration and remote access
- Root access security
- Configuration validation
- Systemd service management
#DevOps #Linux #SSH #Cybersecurity #KodeKloud #LearningInPublic
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.