我无法configuration代理转发与PuTTY 🙁
PuTTY是最新的0.61版本。 我为PuTTY创build了公钥/私钥对,将它们转换为openssh格式,并将它们添加到host1和host2上的/root/.ssh/authorized_keys。 在/ etc / ssh / sshd_config中的两台主机上:
PermitRootLogin without-password AuthorizedKeysFile %h/.ssh/authorized_keys AllowAgentForwarding yes
包含两个主机/root/.ssh/config
Host * ForwardAgent yes
在PuTTYconfiguration中,选中Connection / SSH / Auth / Allow agent forwarding [x]选项。
汗我运行pagent.exe加载密钥文件,我可以连接到host1和host2没有密码。 但是当我连接到host1并尝试ssh root@host2 ,系统会提示input密码。 variables$ SSH_AUTH_SOCK未在我的host1会话中设置。 我究竟做错了什么?
由于$ SSH_AUTH_SOCK没有设置,它可能是putty / pagent或sshd本身的问题。
你可以很容易地把sshddebugging到debugging模式。 login到服务器(这可以通过ssh安全地完成,只要您记得在完成后重新启动sshd)并停止sshd(通过您的init脚本)。 然后运行:
/ usr / sbin / sshd -Dddd
(-D用于前台模式,-ddd用于详细debugging)
尝试再次通过腻子连接,并观看从sshd的输出。 如果腻子发送代理转发密钥,您应该看到一些关于[email protected]。 如果你没有看到,那么腻子不能正确地发送代理转发/请求代理转发。
这应该缩小问题所在。 您也可以在host1中运行'ssh -vvv'以获得详细的debugging输出,同时尝试将ssh传送给host2。
(在这一点上,请记住按Ctrl + C前台sshd进程,并从您的init脚本重新启动它,否则您将被locking在您的服务器!)
问题出在screen 。 这是由PuTTY启动screen -d -RR (连接/ SSH /远程命令)删除主机。 我在这里find了解决办法,稍作修改:
在〜/ .bashrc:
# Correct screen and tmux behavior with ssh-agent parent="$(ps -o comm --no-headers $PPID)" case $parent in sshd) keep_vars="SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION DISPLAY XAUTHORITY" touch $HOME/.ssh/keep_vars chmod 600 $HOME/.ssh/keep_vars for i in $keep_vars; do (eval echo export $i=\\\'\$$i\\\') done > $HOME/.ssh/keep_vars ;; screen|tmux) source $HOME/.ssh/keep_vars ;; esac # This command must be run from shell within detached and re-attached screen session # to interact with ssh-agent properly alias fixssh="source $HOME/.ssh/keep_vars" alias ssh="source $HOME/.ssh/keep_vars; ssh"
每一个连接,我的代理variables存储在$HOME/.ssh/keep_vars每个新的打开的窗口可以立即连接到其他机器与我的密钥 – 它从屏幕上收到适当的variables。 在旧窗口中,我需要键入fixssh ,然后尝试连接。
我声称Putty正在使用与加载到Pageant中不同的键。 在密钥上设置一个密码,将其加载到Pageant中,并查看Putty在连接时是否仍然要求密码。