ssh问题解决

在虚拟机中安装了Redhat linux 6,在win7使用SSH secure shell客户端连接。
1、正常生成公钥和私钥,将公钥test.pub上传至/root/.ssh
2、ssh-keygen -i -f test.pub >> authorized_keys
3、chmod 600 authorized_keys
4、chmod 700 .ssh
5、修改/etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

6、service sshd restart
7、正常情况,就可以使用public_key连接了,我遇到的情况,在服务器端ssh本机,如ssh localhost,在关闭密码登陆的情况,报
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
,原因是selinux开启了,阻碍了对authorized_keys的读取,解决办法是
暂时关闭(重启后恢复):
setenforce 0


永久关闭(需要重启):
vi /etc/selinux/config  
SELINUX=disabled

引用自[url]http://flysnowxf.iteye.com/blog/1567570[/url]
8、ssh连接日志查看路径 tail -f /var/log/secure
9、linux服务器之间免登录的实现,原理基本如上,就是先生成一个不需要密码的公钥,传给服务端,追加到authorized_keys即可
ssh-keygen -t rsa

10、以下日志,应不影响使用,要消除该问题,可在服务端hosts里增加一行 192.168.1.103 域名 或者编辑本地ssh 客户端文件 /etc/ssh/[b]ssh_config[/b]将GSSAPIAuthentication 设置成no 或者编辑服务器端/etc/ssh/[b]sshd[/b]_config将GSSAPIAuthentication 设置成no(后两种方式我试了感觉不起作用)
Address 192.168.1.103 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!

11、SSH Secure Shell Client用public key认证登录,引用[url]http://www.pyshell.com/index.php/archives/302[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值