Rop
Rop

Reputation: 3409

cygwin ssh gives "Killed by signal 1" on exit

After using cygwin's ssh to login from windows to linux-hosts, when exiting the remote shell, I always get the annoying msg:

"Killed by signal 1"

I googled, and realize its harmless, but still annoying... Some suggested you can get rid of the message by using

$ ssh -q ...

But that has no effect on any of the machines I've tried.

Anyone knows a working solution to get rid of this msg?

Upvotes: 25

Views: 29585

Answers (6)

obor
obor

Reputation: 31

In a script bash, to get rid of this message, add the following at the top:

exec 2> >(grep -v "Killed by signal 1.")

Upvotes: 3

Irfy
Irfy

Reputation: 9587

I'm adding a new answer because I have a new solution under different circumstances.

When using the modern ProxyJump directive, there is no place to put the -q, as with ProxyCommand:

Host target
  ProxyJump proxy

Instead of switching back to the more manual jump definition with ProxyCommand, the solution with ProxyJump is to add LogLevel QUIET to a Host proxy definition:

Host target
  ProxyJump proxy
Host proxy
  LogLevel QUIET

which will have the same effect as the -q in ProxyCommand's ssh -q proxy ....

Upvotes: 6

Hongbo Liu
Hongbo Liu

Reputation: 3064

Adding following line to your ~/.ssh/config file can squash that message.

Update: QUIET must be all CAPS & must added for each host in your config.

LogLevel QUIET

Added in first line will squash the message globally. Will only take effect for the specific hosts if it's placed under Host.

Upvotes: 10

Jon Nalley
Jon Nalley

Reputation: 511

If you enable connection sharing with the ControlMaster directive you can share a single connection when proxying sessions through another host. You can then set the ControlPersist directive to 1 second which will avoid the 'killed by signal 1' error by delaying the termination of the shared connection.

Add the following to your ~/.ssh/config

ControlMaster auto
ControlPersist 1
ControlPath ~/.ssh/.%C

Upvotes: 1

Irfy
Irfy

Reputation: 9587

This happens when you proxy your ssh session through another host. Example .ssh/config file:

# machine with open SSH port
Host proxy
HostName foo.com

# machine accessible only from the above machine
Host target
HostName 192.168.0.12
ProxyCommand ssh proxy nc %h %p

When you exit from an ssh target, the ssh in ProxyCommand will cause the output. If you add the -q there, it will be suppressed:

ProxyCommand ssh -q proxy nc %h %p

You may be surprised that this output has nothing to do with Cygwin -- it happens on Linux as well.

Upvotes: 46

Paul Calabro
Paul Calabro

Reputation: 1906

Perhaps, you might like PuTTY as an alternative. I don't think it gives that error AND it allows you to do things like save connection info as well as other niceties.

Though I haven't tried it, you might also be able to redirect sterr (which is the stream I believe that message would be sent to) to /dev/null (effectively, the bitbucket or bottomless void where things go to die). You could do possibly do something like:

ssh user@host 2>/dev/null

Upvotes: 0

Related Questions