- Open the terminal and log in as root or use the sudo command.
- Edit the SSH server configuration file located at /etc/ssh/sshd_config using a text editor such as nano or vi.
- Find the line that reads “#PermitRootLogin” and change it to “PermitRootLogin yes” to allow root access via SSH.
- Find the line that reads “#PubkeyAuthentication” and change it to “PubkeyAuthentication yes” to allow public key authentication for SSH connections.
- Save and exit the configuration file.
- Set the SSH server to start automatically on boot by running the command “systemctl restart ssh”.
sudo systemctl restart ssh
sudo systemctl reload ssh