大网数据广告活动
服务器运维问答

Making ssh agent available in screen after I logout

· 52CE 我爱测

What is the best way to enable a command running in screen on a first machine to continue to be able to run commands on a second machine after I am no longer connected to the first? Here is the background. I have a long running c…

问题原文

原帖链接 · btilly · CC BY-SA 3.0

What is the best way to enable a command running in screen on a first machine to continue to be able to run commands on a second machine after I am no longer connected to the first?

Here is the background. I have a long running command which needs to regularly collect information from other machines. It does this by sending ssh commands and reading the output. This currently works through ssh agents because I logged in with ForwardAgent.

Currently I can ssh to the first machine, run the command, and it works. Likewise I can start a screen, run the command, disconnect from screen, and it continues running. But if my ssh connection to the first machine breaks, then the ssh agent stops working and the command running in the screen breaks.

I would like the command to be able to run correctly even though I am no longer connected to either machine.

已采纳解答

原帖链接 · Zoredache · CC BY-SA 3.0

AFAIK, that isn't going to be possible. The private keys used by the agent are never transmitted to that intermediate server. If your connection to the intermediate server is lost, there is simply nothing to use for authentication. The agent protocol is design so that your private keys never get transferred away from the system running the agent.

If you are frequently doing work from this Intermediate system, your best option might be to generate a keypair unique to that system, and load it into an agent running on that system when you login and start your process. Obviously, you would also need to publish the associated public key to all the systems you need to access.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。