我正在尝试从Debian笔记本电脑到RPi使用openpgp卡中的私钥。我遵循了在Google上发现的不同提示,尤其是:~/.gnupg/gpg-agent.conf
中的
/run/user/<uid>/gnupg
中创建时再次将其删除~/.ssh/config
转发此套接字Host homegearHostName homegearRemoteForward ~/.gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra
/etc/ssh/sshd_config
中StreamLocalBindUnlink yes
但是我总是
Warning: remote port forwarding failed for listen path ~/.gnupg/S.gpg-agent
连接到RPi时。
笔记本电脑和RPi上的
openssh
均为7.4(Debian Stretch),gpg
为2.1.18。转发代理连接以用作ssh私钥(用于从RPi连接到gitlab)效果很好,而转发gpg私钥(用于签署提交)则无法正常工作。我现在有点无奈。明显有什么问题吗?还是转发unix域套接字有问题,我需要使用socat解决方法吗?
谢谢!
最佳答案
除了在两台运行10.14.2的Mac和GPG 2.2.11的Mac之间,我遇到了完全相同的问题,而我能够使它正常工作的唯一方法是指定两端套接字的绝对路径。 :(拥有远程或本地套接字的相对路径都以各种方式失败,如果在各种计算机上以不同的用户名进行连接,这将使您感到痛苦。
我可以通过在Match exec
中指定许多不同的~/.ssh/config
块来解决此问题:
# Source machine is a personal Mac, connecting to another personal Mac on my local network
Match exec "hostname | grep -F .core" Host *.core
RemoteForward /Users/virtualwolf/.gnupg/S.gpg-agent /Users/virtualwolf/.gnupg/S.gpg-agent.extra
# Source machine is a personal Mac, connecting to my Linux box
Match exec "hostname | grep -F .core" Host <name of the host block for my Linux box>
RemoteForward /home/virtualwolf/.gnupg/S.gpg-agent /Users/virtualwolf/.gnupg/S.gpg-agent.extra
# Source machine is my work Mac, connecting to my Linux box
Match exec "hostname | grep -F <work machine name>" Host <name of the host block for my Linux box>
RemoteForward /home/virtualwolf/.gnupg/S.gpg-agent /Users/<work username>/.gnupg/S.gpg-agent.extra
(SSH位来自this answer)。