ssh免密码自动登录及相关问题解决
来源:互联网 发布:yy频道挂机软件下载 编辑:程序博客网 时间:2024/06/07 05:56
1 自动登录
A为客户端,B为服务器,目的是从A ssh远程登录到B不需输入密码
在A上:
#ssh-keygen -t dsa (连续三次回车, 使用缺省值)
#scp ~/.ssh/id_dsa.pub [remoteuser]@[remotehost]:
在B上:
#cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
#chmod 644 ~/.ssh/authorized_keys
2 问题一: 每次执行ssh [remoteuser]@[remotehost] 都要输入密码, 尽管按照1建立了ssh相互认证
解决办法:
A和B的HOME目录的权限必须为700
在A和B上都执行: #chmod -R 700 /home/[user]
在B上, ~/.ssh/authorized_keys权限为644
#chmod 644 ~/.ssh/authorized_keys
2 问题二:ssh或scp连接的时候很慢
解决办法:
最为常见的原因是B上的sshd会去DNS查找访问A IP的hostname, 如果DNS不可用或无相关记录, 则会导致很长的时延
1)在B上/etc/hosts文件中把A的ip和hostname加入
2)在B上/etc/ssh/sshd_config文件中修改或加入 UseDNS=no
3)注释掉/etc/resolv.conf中所有行
4)修改B 上/etc/nsswitch.conf中hosts为hosts:files
5)reboot B
另外也有可能涉及openssh kerberos authenticatioin。 如果执行 ssh -v remoteip, 显示如下:
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
则在B上/etc/ssh/sshd_config文件中修改
#GSAPI options
#GSSAPIAuthentication no
#GSSAPIAuthentication yes
#GSSAPICleanupCredentails yes
#GSSAPICleanupCredentails yes
然后重起sshd
/etc/init.d/sshd restart
- ssh免密码自动登录及相关问题解决
- SSH协议及免密码登录
- SSH免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh 免密码登录
- SSH免密码登录
- ssh 免密码登录
- ssh 免密码登录
- ssh免密码登录
- SSH 登录 免密码
- 关不了机??!!
- PHP - PDT - General-Appearance-Colors and Fonts - Colors and Fonts-Basic-Text Font
- cmd命令
- HSQLDB使用总结
- 我也学着写博客.....
- ssh免密码自动登录及相关问题解决
- 开放API的设计考虑--从Alisoft Saas Platform API及Google Docs API(Gadget API)的比较说起
- jsf的鸡筋
- Nebula3的Input系统
- 三层架构的开发
- 转下前几天在BAIDU空间写的
- 15-list()调用accept()
- 学习日志 2008.10.07
- linux乱码问题解决办法