Search code examples
sshscp

How to suppress "killed by signal 1." error on ssh jump connection


I am using scp and ssh connections with following commands and yet keep getting "killed by signal 1." errors.

scp example:

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

ssh example:

$ 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.

I tried using -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.

I tried using 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.

I tried using the ProxyCommand option:

$ 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.

How do I suppress this error message on command line in a bash script?


Solution

  • Add 2>/dev/null to the ssh command:

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