Permission denied (publickey)
时间: 2023-10-21 19:29:32 浏览: 53
"Permission denied (publickey)"错误是在使用ssh连接远程服务器时出现的错误提示。这个错误通常有以下几个可能的原因。
第一个可能的原因是远程主机禁用了ssh密码登录权限,只允许使用公钥进行认证。这意味着本地生成的公钥没有被添加到远程服务器的认证文件中,或者已经被取消了。解决这个问题的方法是确保本地公钥(~/.ssh/id_rsa.pub)已经被正确地添加到远程服务器的认证文件(~/.ssh/authorized_keys)中。同时,还需要确保远程服务器的公钥文件夹权限正确,即.ssh和.ssh/authorized_keys只有用户自己有权限访问。
第二个可能的原因是远程服务器的~/.ssh文件夹及其文件的权限不正确。这包括~/.ssh/authorized_keys文件的权限以及~/.ssh文件夹的权限和所有权。正确设置这些权限可以解决这个问题。
最后,如果以上两个方法都没有解决问题,可能需要允许ssh密码登录权限来解决问题。
综上所述,要解决 "Permission denied (publickey)"错误,可以尝试以下几个步骤:
1. 确保本地生成的公钥已经添加到远程服务器的认证文件中,并且文件权限正确。
2. 确保远程服务器的~/.ssh文件夹及其文件的权限正确。
3. 如果问题仍然存在,尝试允许ssh密码登录权限。
希望这些解决方法能够帮助你解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
相关问题
permission denied,public key
This error message usually occurs when you are trying to access a remote server using SSH (Secure Shell) and the server is not able to authenticate your identity.
There could be several reasons for this error, including:
1. Incorrect permissions on your local ~/.ssh directory or files.
2. Incorrect permissions on the remote server's authorized_keys file.
3. You are using the wrong public key file to authenticate yourself.
4. The public key you are using is not added to the authorized_keys file on the remote server.
To resolve this issue, you can try the following steps:
1. Check the permissions on your local ~/.ssh directory and files. The directory should have permissions of 700, and the files should have permissions of 600.
2. Check the permissions on the remote server's authorized_keys file. The file should have permissions of 600.
3. Check that you are using the correct public key file to authenticate yourself.
4. Check that the public key you are using is added to the authorized_keys file on the remote server.
If none of these steps work, you may need to contact the server administrator for assistance.
permission denied (publickey)
"permission denied (publickey)"意味着在SSH登陆时,远程服务器不接受用户提供的公钥,从而拒绝访问。 在SSH登陆时,服务器会比对提供的公钥是否存在于自己的公钥白名单中,如果不在其中就会出现这个错误。 想要解决这个错误,可以尝试以下几个方法:1.确保提供的公钥是正确的;2.在远程服务器上添加公钥;3.检查.ssh/authorized_keys文件权限;4.使用正确的用户名和密码登陆。如果以上方法都不起作用,还可以尝试删除.ssh/known_hosts文件,并重新与远程服务器建立连接。总之,这个错误通常可以通过检查公钥和登陆凭证等方面来解决。