随笔-ssh-FAQ
ssh免密登录ssh-copy-id
ssh-copy-id - 将你的公共密钥填充到一个远程机器上的authorized_keys文件中
SSh免密登陆原理:
将自己的公钥拷贝到remote,登录的时候,remote发过来一串随机字符串,然后你收到后用用你的私钥加密,remote用有对应的公钥,且公钥解密成功,则表示这个登录用户有登录密码(用户要有登录密码才能将公钥拷贝到remote)
参考:https://www.jellythink.com/archives/555
ssh-copy-id 之后仍需要密码
排查:ssh -vv ...
错误:ssh send_pubkey_test: no mutual signature algorithm
原因:openssh默认不再支持ssh-rsa算法啦,说是该算法存在安全隐患, 具体可以看看这则消息:OpenSSH to deprecate SHA-1 logins due to security risk | ZDNet
解决:
- ssh-keygen -t ed25519
- ssh-copy-id -i ~/.ssh/id_ed25519.pub root@192.168.78.xxx
ssh登录慢问题
# vi /etc/ssh/sshd_config
UseDNS no
# systemctl restart sshd
ssh会话保活,应对一段时间未操作ssh会自动退出会话场景
-o TCPKeepAlive=yes -o ServerAliveInterval=300
ssh Jump Host 跳板机
ssh -A -J user@tiaobanji user@target.example.com
or
Host target
HostName target.example.com
User user
ProxyJump user@tiaobanji
本文来自博客园,作者:LiYanbin,转载请注明原文链接:https://www.cnblogs.com/stellar-liyanbin/p/18637808