Log in as Someone and Become Root Deliberately
I still remember the 3:00 AM page from three years ago—the one that’s currently sitting in my notebook under “Preventable Disasters.” I was staring at a terminal, watching a brute-force attack chew through a client’s server resources because they had left the front door wide open. They thought they were safe because they had a decent firewall, but they hadn’t even considered the implications of disabling root login. It’s one of those “security through obscurity” myths that people cling to, thinking that if they don’t notice the attacks, they aren’t happening. In reality, leaving root access enabled is like leaving your house keys in the lock and just hoping nobody walks by.
I’m not here to sell you on some expensive, enterprise-grade security suite that you don’t need. Instead, I’m going to show you the boring, practical steps to actually lock things down. We’re going to walk through the configuration changes required for disabling root login properly, ensuring you don’t accidentally lock yourself out of your own system in the process. No fluff, no marketing jargon—just the straightforward technical reality of how to stop being an easy target.
Securing Ssh Daemon Closing the Front Door to Brute Force Attacks

Once you’ve created a dedicated user with sudo privileges, the next step is actually locking the door. This means diving into your `sshd_config` file to implement some real securing ssh daemon protocols. Most people think having a strong password is enough, but if you leave the root account accessible, you’re essentially leaving a VIP entrance open for every botnet on the internet. You need to find the line that says `PermitRootLogin` and change it to `no`. Setting `PermitRootLogin none` is one of those fundamental linux server hardening best practices that separates the pros from the amateurs.
Don’t just change the setting and walk away, though. After you save the file, you must test your new user’s sudo access in a separate terminal window before you log out of your current session. I’ve seen too many people lock themselves out of their own boxes because they assumed their new user worked. It’s a boring, manual step, but it’s the only way to ensure you aren’t accidentally performing a self-inflicted denial-of-service attack while trying to prevent brute force attacks.
Linux Server Hardening Best Practices Moving Beyond Default Credentials

Once you’ve locked the front door by setting `PermitRootLogin none`, you can’t just sit back and assume you’re safe. Real linux server hardening best practices require looking at the environment as a whole. If you leave a system running with default credentials or a single, overpowered user account, you’re essentially leaving a map for anyone who manages to bypass your initial defenses. I’ve seen too many setups where a single compromised account leads to a total system takeover because the user had too much power from the start.
This is where you need to focus on managing user privilege escalation. Instead of logging in as a high-level user for every minor task, you should be using a standard user account and invoking `sudo` only when absolutely necessary. It’s a small friction point in your workflow, but it’s a massive hurdle for an attacker. By enforcing the principle of least privilege, you ensure that even if a service gets poked or a password gets leaked, the damage is contained. Don’t make it easy for them.
The Practical Checklist for Making the Switch
- Create a dedicated sudo user first. Do not—under any circumstances—disable root access until you have logged in with a standard user and verified that `sudo` works perfectly. I’ve seen too many people lock themselves out of their own servers because they forgot they hadn’t configured permissions correctly.
- Use SSH keys, not passwords. Once you’ve moved away from the root account, stop relying on passwords for your new user. Set up Ed25519 keys. It’s one of those “boring” security steps that makes brute-forcing your credentials mathematically impossible.
- Audit your sudoers file. After you’ve moved to a non-root user, check `/etc/sudoers` to ensure your new user has the right level of access. You want enough power to manage the system, but you don’t want to leave the door wide open for every script running on the machine.
- Test your connection in a separate window. Before you close your current, active root session, open a new terminal window and try to log in as your new user. If you mess up the configuration, you still have the original session open to fix it. This is basic, but people skip it and regret it when the screen goes dark.
- Monitor your auth logs. Disabling root doesn’t stop the bots from hitting your server; they’ll just start hitting your new username instead. Keep an eye on `/var/log/auth.log` to see if the attack patterns change, and make sure your new user isn’t being targeted by the same automated scripts.
The Bottom Line
Stop treating root as your daily driver; it’s an open invitation for bots, and the extra thirty seconds it takes to sudo is worth the peace of mind.
Security isn’t about flashy tools; it’s about fixing the basic, boring configurations—like disabling root SSH access—that most people ignore until they’re cleaning up a mess.
Before you lock yourself out, make sure you have a non-root user with sudo privileges already set up and tested, or you’ll be staring at a dead terminal.
Stop Making It Easy for Them

At the end of the day, disabling root login isn’t some complex architectural overhaul; it is just basic hygiene. We have covered the essentials: locking down your SSH daemon, moving away from default credentials, and ensuring you have a non-root user with proper sudo privileges ready to go. If you skip these steps, you aren’t just being “efficient”—you are essentially leaving your front door unlocked in a bad neighborhood and wondering why your server is getting hammered by botnets. Most of the outages and breaches I’ve seen in my notebook didn’t start with a sophisticated zero-day exploit; they started because someone left a standard, predictable entry point wide open for a brute-force script to find.
I know it feels like extra work to manage separate user accounts and keys, but that friction is exactly what you want. Security is often about making the wrong way to do things just a little too annoying for an attacker to bother with. Don’t wait for a midnight page to realize your server was compromised because you wanted to save thirty seconds of typing. Build your systems with the assumption that the boring stuff matters most. Secure the basics now, so you can spend your time actually growing your business instead of cleaning up a digital crime scene.
Frequently Asked Questions
If I disable root login and my sudo user loses permissions, am I effectively locked out of my own server?
Yes, you absolutely are. If you disable root and your sudo user is broken, you’re staring at a very expensive brick. This is exactly why I keep my outage notebook; I’ve seen people lock themselves out because they rushed a config change without testing it. Before you commit to disabling root, verify your sudo user works in a separate terminal window. Never close your current session until you’ve confirmed you can still escalate privileges.
Does disabling root login actually stop brute force attacks, or does it just move the target to my personal username?
Look, it doesn’t stop the noise, but it changes the math. If you leave root enabled, every bot on the planet is hammering that one specific username with every password in their dictionary. When you disable it, you’ve forced them to guess both a unique username and a password. It’s like moving your valuables from a glass case to a plain wooden box; it’s still there, but you’ve added a layer of friction that makes the easy wins much harder.
Is it better to completely disable root login via SSH, or should I just restrict it to specific IP addresses?
If you have the luxury of a static IP, restricting root to that specific address is a solid layer of defense. But if you want to actually sleep at night, just disable it entirely. Relying on IP whitelisting is fine until your ISP changes your lease or you’re working from a cafe. Create a standard user with sudo privileges instead. It’s one more step in the workflow, but it’s a step that prevents a massive headache.