Why I cannot login remote server with its root

Why You Can’t Login to a Remote Server as Root (and How to Fix It)

If you’ve tried ssh root@my-server and got a “Permission denied” error, it’s not a bug—it’s a security feature.

The Reason: PermitRootLogin

In the /etc/ssh/sshd_config file, the line PermitRootLogin is set to prohibit-password or no by default on almost all modern Linux distributions (Ubuntu 22.04+, Debian 12, Fedora 40).

The 2026 Best Practice: sudo

  1. Login as a standard user: ssh user@my-server
  2. Escalate privileges: sudo -i or sudo su -

Why This is Critical in 2026

  • Audit Trails: When everyone logs in as themselves and uses sudo, the system logs show exactly who ran a root command. If everyone logs in as root, you lose that accountability.
  • Brute-Force Protection: Attackers constantly scan the internet for open SSH ports trying to log in as “root.” By disabling root login, you eliminate half of the attack vector.
  • Key-Based Auth: In 2026, password-based SSH login is considered obsolete. Always use SSH keys and disable PasswordAuthentication in your sshd_config.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *