DEV Community

Cover image for Secure SSH by Using a Restricted User: Smarter Linux Hardening
Richard Chamberlain
Richard Chamberlain

Posted on

Secure SSH by Using a Restricted User: Smarter Linux Hardening

Here's a shortened version of your article tailored for platforms like dev.to and Medium, designed to tease the full content while encouraging users to visit your site.


🔐 Harden Your SSH: The Case for Using a Restricted User

SSH is the lifeline for managing Linux systems—but with great power comes great risk. If your administrative account is exposed over SSH, you're giving attackers a direct shot at your most critical assets.

That’s why I’ve adopted a simple but powerful security pattern:

Login with a restricted user
🔒 Switch to admin only after connecting

In this post, I explain:

  • Why using two separate user accounts improves security
  • How to configure a restricted shell (rbash)
  • Techniques to limit executable commands
  • Whether this is overkill—or just smart Linux hardening

Here's a quick preview of the setup:

# Create restricted shell
sudo usermod -s /usr/bin/rbash richard

# Allow only safe commands
sudo mkdir /home/richard/.bin
sudo ln -s /bin/ls /home/richard/.bin/ls
Enter fullscreen mode Exit fullscreen mode

This strategy significantly reduces your attack surface, even if a laptop or SSH key is compromised.


👉 Want the full walkthrough?
Read the complete guide here: sebostechnology.com


Need Linux expertise? I help businesses streamline servers, secure infrastructure, and automate workflows. Whether you're troubleshooting, optimizing, or building from scratch—I've got you covered.

📬 Drop a comment or email me to collaborate. For more tutorials, tools, and insights, visit sebostechnology.com.

Top comments (0)