If you are using SSH keys, disabling access to the server via password will be a useful additional security measure for you.

Switching off via nano

Use the following command:

nano /etc/ssh/sshd_config

We get into the sshd config.

We find the string PasswordAuthentication yes

We need to remove the grid (#) so that the row becomes active. And then we change the value of yes to no.

Press Ctrl + X, enter Y to save.

Restarting the SSH service:

sudo service ssh restart

Disconnection via sFTP

In the panel above the file manager, we need to erase the standard path /root and specify /etc/ssh

In this directory, we need to open the sshd_config file.

We find the corresponding PasswordAuthentication yes string.

Remove the grid (#) so that the line becomes active. And then we change the value of yes to no.

We save the file and send it to the server.

Restarting the SSH service:

sudo service ssh restart

Using an SSH key in sFTP

After enabling access only via SSH key, a problem may arise when connecting via sFTP, which is extremely simple to solve at the moment.

FileZilla

Click on the Edit category and select Settings

Then select the sFTP page and click the Add Key File button.

Select the location and add the file.

The key has been added, now FileZilla will take it into account when trying to connect to servers.

WinSCP

Click on the button to create a new connection:

A window opens. Here we specify the IP address of the server and the Username.

Use the More button under the Password line.

In the window that opens, select the Authentication section.

Add the private key and click OK.

We are trying to connect to the server.

The program requests the secret key code, we enter spacecore:

We have connected to the server!

Last updated