Disabling password-based access to Linux
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:
nano /etc/ssh/sshd_config
This opens the sshd configuration file.

Â
Locate the line PasswordAuthentication yes

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

Press Ctrl + X and enter Y to save.
Restart the SSH service:
sudo service ssh restart
Disabling via sFTP
In the panel above the file manager, remove the default path /root and specify /etc/ssh

Â
In this directory, open the sshd_config file.

Â
Locate the line PasswordAuthentication yes.

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

Â
Save the file and upload it to the server.

Restarting the SSH service:
sudo service ssh restart
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.

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

Â
Select the file location and add the file.

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:

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

Â
Click the Advanced button under the Password field.

Â
In the window that opens, select the Authentication section.

Â
Add the private key and click OK.

Â
Try connecting to the server.

Â
The application prompts for the key passphrase, enter spacecore:

Â
You are now connected to the server.








