分享 ssh-agent - windows 服务,msys2 shell

问题描述

设置:Windows 10、ConEmu 中的 Msys2、鱼壳

我想运行 ssh-agent 并在 shell 之间共享它,这本身不是问题。 全局设置 $SSH_AUTH_SOCK 变量,甚至使用 ~/.ssh/environment 文件都可以。

然而,我首先启动的任何 shell 都将是 ssh-agent 进程的所有者,并在我关闭该终端窗口时关闭。 起初我以为这就是答案:https://www.msys2.org/wiki/Setting-up-SSHd/ 但是 sshd != ssh-agent .. dooh

所以我想知道,如果我使用该脚本作为基础并设置运行 ssh-agent 作为 cygrunsrv 服务,这是否有意义且有效。

我遇到了问题,ssh-agent sockets are owned by the uid which created it and can only be used by that uid and superuser

管理员权限运行 msys2 似乎不能满足“超级用户”的要求。

这只是行不通吗?如果是这样,还有什么选择?我并不真的倾向于让一个 conmu shell 一直打开并小心不要关闭它。

每个 shell 使用一个 ssh-agent 也不是我真正喜欢考虑的事情,因为我每次都必须重新输入我的私钥的密码。

解决方法

nohup 应该通过将 ssh-agent 进程与其终端分离来解决原始问题。