Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Error occurred during login of putty key

Shulou Source: shulou.com Published: 2022-06-01 08:11:48 11月26日 Update

When we log in using putty, we often use the key for verification for the sake of security. However, the author encountered an error when doing the experiment. Enter the user name and display: Server refused our key

After searching on the Internet, I found that many people encountered this problem and the key could not be used, so the author summarized a few points about this error:

The firewall is not turned off

This is the most common and easiest mistake, but it is also easy to solve, and there are two ways to turn off the firewall:

1. Command: # setenforce 0

Temporarily shut down and turn on automatically when the system is rebooted

2. Command: # vim / etc/selinux/config, change "enforceing" to "disabled", and take effect after restart

3. Command: # getenforce to view the status of firewall selinux at this time

Second, permission error

We save the public key content in the file / root/.ssh/authorized_keys, but we must change the permission of the directory .ssh to 700, and the file in it to 600 (or other users cannot change it), otherwise the system will automatically invalidate if it finds that our public key content is not secure enough.

Command: # chmod 700 / root/.ssh

Third, some people may because the sshd service is not configured correctly

/ etc/ssh/sshd_config 1. Find # StrictModes yes and change it to StrictModes no (change it to no after removing comments)

2. Find # PubkeyAuthentication yes and change it to PubkeyAuthentication yes (remove comments) 3. Find

# AuthorizedKeysFile .ssh / authorized_keys change to AuthorizedKeysFile .ssh / authorized_keys (remove

Note) 4. Save 5, / etc/rc.d/init.d/sshd reload reload

Tags: Commands comments firewalls fire protection keys security public keys contents files permissions users authors systems errors problems login insufficient common ways status Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi vpn OPPO Reno Shulou Technology Shulou Information