如何在ssh跳转连接上抑制“被信号1杀死”错误

问题描述 投票:0回答:1

我使用scp和ssh连接与以下命令,但仍然“被信号1杀死”。错误。

scp示例:

$ scp -q '-oProxyCommand=ssh -W %h:%p {user}@{jump_server}' /path/file.txt
{user}@{server2}:/tmp/
Killed by signal 1.

ssh示例:

$ ssh -A -J {user}@{jump_server} -q -o BatchMode=yes -o ServerAliveInterval=10 {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.

我尝试使用-t:

$ ssh -t -A -J {user}@{jump_server} -t -q -o BatchMode=yes -o ServerAliveInterval=10 {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.

我尝试使用LogLevel:

$ ssh -o LogLevel=QUIET -A -J {user}@{jump_server} -q -o BatchMode=yes -o ServerAliveInterval=10 -o LogLevel=QUIET {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.

我尝试使用ProxyCommand选项:

$ ssh -q -oProxyCommand="ssh -W %h:%p {user}@{jump_server}" -q -o BatchMode=yes -o ServerAliveInterval=10 {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.

如何在bash脚本中的命令行上禁止显示此错误消息?

ssh scp
1个回答
1
投票

2>/dev/null添加到ssh命令:

$ ssh -q -oProxyCommand =“ssh -W%h:%p {user} @ {jump_server}”2> / dev / null

© www.soinside.com 2019 - 2024. All rights reserved.