简体   繁体   English

Linux下的Plink超时和代理

[英]Plink timeout and proxy under linux

I have made a script in bash which create a connection to a list of server. 我在bash中创建了一个脚本,它创建了一个服务器列表的连接。 After each connection, if it succeed, i execute a command. 每次连接后,如果成功,我执行一个命令。 Connections are under a loop. 连接处于循环中。

For know i use Plink. 知道我使用Plink。 My script works, but it takes too much time when the server is unreachable. 我的脚本有效,但服务器无法访问需要花费太多时间。 I encountered another issue when i wanted to reach a server through a proxy. 当我想通过代理到达服务器时,我遇到了另一个问题。

I have two goals : 我有两个目标:

  • Configure the timeout of Plink in command line under Linux to make it shorter ("FATAL ERROR: Connection timed out" takes to much time to appear). 在Linux下命令行中配置Plink超时使其更短(“致命错误:连接超时”需要很长时间才能显示)。

  • Configure the proxy configuration of Plink to have the equivalent of the SOCKS5 and proxy hostname of PuTTY. 配置Plink的代理配置,使其等效于SOCKS5和PuTTY的代理主机名。

I don't know if it is possible. 我不知道是否有可能。 If you have a better way, i'll be glad to know it 如果你有更好的方法,我会很高兴知道它

regards, Mageni 问候,Mageni

Since your client is running Linux, I suggest using the openSSH ssh client that almost certainly comes with it, rather than plink. 由于您的客户端正在运行Linux,我建议使用几乎可以随附的openSSH ssh客户端,而不是plink。

1) OpenSSH's ssh client supports setting connection timeouts from commandline, eg to have it time out after 5 seconds you would use: 1)OpenSSH的ssh客户端支持从命令行设置连接超时,例如让你在使用5秒后超时:

    ssh -o ConnectTimeout=5 <server>

2) Not entirely what you mean by this goal. 2)这个目标并不完全是你的意思。 Are you trying to connect to an SSH server through a socks5 proxy, or trying to configure a socks5 proxy locally by using an ssh client to proxy traffic to a remote system running an SSH server? 您是尝试通过socks5代理连接到SSH服务器,还是尝试使用ssh客户端将流量代理到运行SSH服务器的远程系统来本地配置socks5代理? If you elaborate, I can amend this response to include how to do either one. 如果你详细说明,我可以修改这个回复,包括如何做任何一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM