Search

Monday, April 10, 2023

Enable Root Login via SSH In Ubuntu

 By default, the root account is disabled in Ubuntu for security reasons. However, if you need to enable root login via SSH, you can follow these steps:

  1. Log in to your Ubuntu server as a user with sudo privileges.

  2. Open the SSH configuration file /etc/ssh/sshd_config using your preferred text editor:

    bash
    sudo nano /etc/ssh/sshd_config
  3. Find the following line:

    bash
    #PermitRootLogin prohibit-password
  4. Uncomment the line by removing the # symbol at the beginning and change the value to yes:

    bash
    PermitRootLogin yes
  5. Save and close the file by pressing Ctrl+X, then Y, and finally Enter.

  6. Restart the SSH service to apply the changes:

    sudo systemctl restart sshd

That's it! You can now log in as the root user via SSH. However, keep in mind that enabling root login via SSH can pose a security risk and should be used only when necessary. It is recommended to disable root login via SSH when it is no longer required.

No comments:

Post a Comment