加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 没有密码的SSH

发布时间:2020-12-13 17:16:14 所属栏目:Linux 来源:网络整理
导读:在新的CentOS盒子上出于某种原因,我无法使用密码ssh. 我试过按照这些指南: http://linuxproblem.org/art_9.html http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/ 但两者都没有奏效.我甚
在新的CentOS盒子上出于某种原因,我无法使用密码ssh.

我试过按照这些指南:

> http://linuxproblem.org/art_9.html
> http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

但两者都没有奏效.我甚至检查了我的/ etc / ssh / sshd_config文件. PubkeyAuthentication是最初注释掉的,所以我取消注释该行并重新启动sshd但仍无济于事.有什么想法可以遗漏吗?

我正在尝试以root身份从服务器A ssh到服务器B.因此,以root身份登录到一个框中,然后以root身份ssh到下一个,而不会提示输入密码.

UPDATE

我跑了一个ssh -v …但是无法复制/粘贴到这里.在这一行之前,一切看起来都很好:

debug1: Next authentication method:  gssapi-with-mic
debug1: Unspecified GSS failure.  Minor Code may provide more information
Unknown code krb5 195

解决方法

CentOS / Red Hat / etc基于公钥的身份验证的小方法…

在SSH客户端上:

ssh-keygen # Accept all defaults,do not enter a password.
ssh-copy-id USER@SERVER_IP
restorecon -R ~/.ssh

在SSH服务器上:

# Login to the server normally (with password)
restorecon -R ~/.ssh

基于公钥的身份验证现在应该可行.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读