How to disable SSH login for the root user?

  • To disable root login, open the main ssh configuration file /etc/ssh/sshd_config with your choice of editor.
    • # vi /etc/ssh/sshd_config

  • Search for the following line in the file.
    • #PermitRootLogin no

  • Remove the ‘#‘ from the beginning of the line.  Make the line look like similar to this.
    • PermitRootLogin no

  • Next, we need to restart the SSH daemon service.Now try to login with root user, you will get “Access Denied” error.
    • # /etc/init.d/sshd restart

  • So, from now onwards login as normal user and then use ‘su’ command to switch to root user.
  • 15 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

Connecting to your Linux VPS

Now you received your details you’ll connect to it via SSH if you have a Linux VPS: If your...

How to determine disk space usage?

To check what is taking up space on your server, you can run multiple commands - You can use...

How to Install Linux Malware Detect?

Linux Malware Detect (LMD) is an excellent tool for detecting malware on linux operating system....