Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux ssh登录需要脚本_Linux_Ssh_Expect - Fatal编程技术网

Linux ssh登录需要脚本

Linux ssh登录需要脚本,linux,ssh,expect,Linux,Ssh,Expect,我有一个简单的expect脚本,用于将sshing发送到一台远程机器,该脚本改编自: 唯一的问题是,当我通过键入“exit”退出远程主机时,会有3秒钟的挂起,然后我会得到提示。我不太了解expect的内部结构,所以我想知道是否有人知道原因以及如何避免它。我尝试过这个方法,在退出交互式ssh后没有发现延迟。添加带有expect的-d标志,并发布调试信息。那可以帮助我们。谢谢你的回复。以下是我使用-d开关键入exit后看到的内容:interact:received eof from spawn_id

我有一个简单的expect脚本,用于将sshing发送到一台远程机器,该脚本改编自:


唯一的问题是,当我通过键入“exit”退出远程主机时,会有3秒钟的挂起,然后我会得到提示。我不太了解expect的内部结构,所以我想知道是否有人知道原因以及如何避免它。

我尝试过这个方法,在退出交互式ssh后没有发现延迟。添加带有
expect
-d
标志,并发布调试信息。那可以帮助我们。谢谢你的回复。以下是我使用-d开关键入exit后看到的内容:
interact:received eof from spawn_id exp6 write()无法写入任何内容-将休眠(1)并重试。。。tty_set:raw=0,echo=1 tty_set:raw=5,echo=0
我找到了这个:这也是我的版本。
#!/usr/bin/expect -f
set host [lrange $argv 0 0]
spawn ssh $host
expect "root"
interact