SSH (Secure Shell) is a network protocol that allows users to remotely access, control, and transfer files and other data. It ensures protected communication between two computers by encrypting the connection and safeguarding sensitive information. More specifically, SSH is primarily used for secure file transfers, system monitoring, and tasks requiring a secure communication channel.
This guide will cover the installation and configuration process of SSH and will also let you know how to enable SSH root login on Debian 12.
So let’s begin!
1. Installing SSH on Debian 12
Firstly, install SSH to provide secure access, and manage and configure the server remotely by using the following command:
sudo apt install openssh-server
Next, install SSH client with:
sudo apt install openssh-client
2. Configuring SSH on Debian 12
Configuring SSH is important for secure remote access to your server. This setup allows you to securely connect to your server remotely and make sure that your management and communication are protected.
So, start by checking the status of SSH by utilizing the below command:
sudo systemctl status ssh
In case SSH is not enabled, then enable it using:
sudo systemctl enable ssh
After enabling it, start the SSH service with the command:
sudo systemctl start ssh
This command starts SSH and allows you to connect server remotely:
3. Configuring SSHD on Debian 12
SSHD (SSH Daemon) is the server-side program that handles SSH connections. By configuring SSHD, you can control many settings to manage such as root login permissions. This ensures that remote access is secure and aligns with your server’s security policies.
Now, check the SSHD status to ensure that is enabled through:
sudo systemctl status sshd
To enable and start the SSHD service, use the below command:
sudo systemctl enable sshd
sudo systemctl start sshd
4. Enabling SSH Root Login on Debian 12
If you want to use a Debian root account by SSH, you will get a permission error. To resolve it first open the SSH configuration file with:
sudo nano /etc/ssh/sshd_config
Then paste the below line as indicated in the given image:
PermitRootLogin yes
Now, refresh the SSHD service to make sure that updates have taken effect:
systemctl restart sshd
Conclusion
In this guide, we have covered the installation and configuration process of SSH. We have also looked at how to enable SSH root login on Debian 12.
By installing and setting up the SSH server and client, and adjusting settings such as enabling root login, you can enhance both the security and flexibility of your server management.
Secure?
At least do this
PermitRootLogin prohibit-password
or better
PasswordAuthentication no
Hi Andreios,
In the original guide, I aimed to provide a basic introduction to enabling SSH and root login for new users.
However, I appreciate your feedback on security best practices. Using PermitRootLogin prohibit-password and PasswordAuthentication no enhances security by restricting root access to key-based authentication and disabling password logins.
I’ll update the guide to include these recommendations. Thanks for highlighting this!