Permission denied (publickey,gssapi-keyex,gssapi-with-mic).免密登陆不生效的的完整解决方法

1. 首先在服务器本地测试ssh 127.0.0.1,如果可以那就是防火墙的问题。网上很多解决方法,这里不在写,很好解决。

 2. 若本地连接有问题,首先打开配置文件sshd_config寻找问题(vim /etc/ssh/sshd_config)。这里简单总结几个必须要修改的配置: 
RSAAuthentication yes 
PubkeyAuthentication yes #这两项为打开公钥模式 
AuthorizedKeysFile .ssh/authorized_keys #配置公钥记录文件 
PasswordAuthentication yes #打开密码验证模式
3.selinux问题:#setenforce 0     --临时关闭 

# vim .ssh/authorized_keys  

SELINUX=disable     --永久关闭(需要重启)

4:如果报@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

文件权限过大,

私钥的权限只能是700,执行下面命令修改之后就可以了:

chmod -R 700 ~/.ssh/*

 
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This error message typically occurs when attempting to authenticate to a remote server using SSH (Secure Shell) and the authentication method specified (publickey, gssapi-keyex, gssapi-with-mic) is not allowed or is not set up correctly. There are several possible reasons for this error, including: 1. Incorrect username or password: Double-check that you are using the correct username and password for the remote server. 2. Incorrect SSH key: If you are using publickey authentication, make sure you have the correct SSH key for the remote server. You may need to generate a new SSH key or update the existing one. 3. Incorrect permissions on the SSH key: Make sure the permissions on the SSH key file are set correctly. The SSH key file should only be readable by the user who owns it. 4. SSH service is not running: Check that the SSH service is running on the remote server. If it is not running, you will not be able to connect using SSH. 5. Firewall blocking SSH traffic: Make sure there is not a firewall blocking SSH traffic to the remote server. You may need to add a firewall rule to allow SSH traffic. To resolve the error, try the following: 1. Verify that you are using the correct username and password for the remote server. 2. Make sure you have the correct SSH key for the remote server. 3. Check the permissions on the SSH key file and ensure that it is only readable by the user who owns it. 4. Verify that the SSH service is running on the remote server. 5. Check if there is a firewall blocking SSH traffic to the remote server and add a firewall rule to allow SSH traffic if necessary.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值