Get a VPS server with a 15% discount
Sale ends in
00Days
:
00Hours
:
00Minutes
:
00Seconds

Disabling Linux Password Access

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

Disabling using nano

Use the following command:

This opens the sshd configuration file.

sshd configuration file in the nano editor

Locate the line PasswordAuthentication yes.

PasswordAuthentication line in the config

You need to remove the hash character # to activate the line, then change the value yes to no.

Changed value PasswordAuthentication no

Press Ctrl + X and enter Y to save.

Restart the SSH service:

Disabling via sFTP

In the panel above the file manager, remove the default path /root and specify /etc/ssh.

Specifying the /etc/ssh path in the file manager

In this directory, open the sshd_config file.

sshd_config file in the /etc/ssh directory

Locate the line PasswordAuthentication yes.

PasswordAuthentication line in the file

Remove the hash character # to activate the line, then change the value yes to no.

Changed value PasswordAuthentication no

Save the file and upload it to the server.

Uploading the sshd_config file to the server

Restart the SSH service:

Using an SSH key in sFTP

After enabling SSH key only access, you might encounter an issue when connecting via sFTP, which is very easy to resolve.

FileZilla

Click the Edit menu and select Settings.

Edit menu in FileZilla

Then open the sFTP page and click the Add key file button.

sFTP page in the FileZilla settings

Select the file location and add the file.

Adding the key file in FileZilla

The key has been added and FileZilla will now use it when attempting to connect to servers.

WinSCP

Click the button to create a new connection:

New connection button in WinSCP

A window opens where you specify the server IP address and the username.

Entering the IP address and username in WinSCP

Click the Advanced button under the Password field.

Advanced button under the Password field

In the window that opens, select the Authentication section.

Authentication section in the WinSCP settings

Add the private key and click OK.

Adding the private key in WinSCP

Try connecting to the server.

Connecting to the server in WinSCP

The application prompts for the key passphrase, enter spacecore:

Entering the key passphrase

You are now connected to the server.

Successful connection to the server