How to install and enable SSH on Debian

  • Last updated: Oct 26, 2024
  • Views: 52
  • Author: Admin

To manage a server or workstation in Debian-based Linux remotely, it is most convenient to use the SSH (Secure Shell) protocol. SSH is a protocol that provides a secure connection between the client and the server and ensures secure data transfer over the network.

Installing and configuring SSH will allow you to securely manage your server, access files remotely, and execute commands, which is especially important for a system administrator and developer working with a remote server.

In this article, we will look at how to install SSH on Debian, configure it, and ensure a secure connection.

 

Contents of the article:

  1. Installing updates.
  2. Checking if SSH is installed on the server.
  3. Installing SSH.
  4. Checking SSH services.
  5. Checking connection to the server.

 

1. Installing updates.

Before installing SSH, you need to update all packages to the latest version. To do this, use the command:

~$ sudo apt update && sudo apt upgrade


 

2. Checking if SSH is installed on the server.

By default, all versions of Debian do not have the SSH package installed, to make sure of this we need to perform a test local connection to the current server using the command:

~$ ssh localhost

debian check install ssh

If you receive "Connection refused" messages as a result, this means that ssh is not installed on the server.


 

3. Installing SSH.

Now it's time to install SSH itself, for this we use the command:

~$ sudo apt install openssh-server

debian install openssh

We confirm the installation and wait a little while until ssh is installed.


 

4. Checking SSH services.

Now we need to check how the SSH service works. In Debian, the service is called ssh and to check its operation, we use the command:

~$ sudo service ssh status

debian check enable service ssh

If the Active field contains the value "active (running)", this means that the ssh service is working successfully, and now you can try to connect to the server from outside.


 

5. Checking connection to the server.

Now that we have installed SSH and checked how the service works, it is time to check the connections to the server. For the test, I will use the mRemoteNG program.

debian check connect to server

As we can see, as a result I was able to successfully connect to the server using an external client.


 

As a result, today we looked at how easy and quick it is to install SSH on a Debian server.

 

SIMILAR ARTICLES