Cannot perform a remote backup to a Debian target server due to disabled root SSH access

Unlocking SSH Under Root on Debian OS Target Server Via Terminal for Remote Backup

Problem

Cannot perform a remote backup to a Debian target server.

Debian has SSH access under root user disabled by default.

Solution

Enable SSH access under the root user.

  1. Access the terminal/console of the remote server.

  2. Run the following command to permit root login:     

sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config

  3.  Run the following command to restart the SSH service: 

systemctl restart sshd.service

NOTE:

After performing your backup operation, it may be desirable to disable root access again for security reasons.

To re-secure the root account:

  1. Access the terminal/console of the remote server.

  2. Run the following command to permit root login:

    sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/g' /etc/ssh/sshd_config
  3.  Run the following command to restart the SSH service:

     systemctl restart sshd.service