Install SSH on Debian: A Complete Guide

To install the SSH service on Debian, you can follow these steps:

  1. Open the terminal and log into the system as the root user or a user with sudo privileges.
  2. Run the following command to update the system software package list:
  3. Please update the apt package manager.
  4. Install the OpenSSH server software package.
  5. Please install openssh-server using the sudo apt command.
  6. During the installation process, you may be prompted to enter confirmation to continue the installation. Enter “Y” and press the Enter key.
  7. After the installation is complete, the SSH service will start automatically. You can check the status of the SSH service using the following command.
  8. Check the status of the ssh service by using the command: sudo systemctl status ssh
  9. If the SSH service is running, you will see an output line similar to “Active: active (running)”.
  10. By default, the SSH service will authenticate all users in the system. If you want to restrict SSH access to specific users only, edit the SSH server configuration file.
  11. open the sshd_config file located in /etc/ssh using the nano editor with superuser privileges
  12. In the opened file, locate the line “#PermitRootLogin prohibit-password” and change it to “PermitRootLogin no”. This will disable root user login via SSH.
  13. If you want to allow specific users to log in via SSH, add the following line:
  14. Grant access to specific users by using their usernames.
  15. Replace “username” with the username(s) you wish to allow for login. If there are multiple users, separate them with a space.
  16. Save the file and exit the editor.
  17. Reload the SSH server configuration to apply the changes.
  18. Reboot the ssh service using systemctl.

You have now successfully installed and configured the SSH service. You can now use an SSH client to connect to the Debian system.

bannerAds