cygwin ssh gives “Killed by signal 1” on exit

2020-06-30 06:52发布

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?

6条回答
贼婆χ
2楼-- · 2020-06-30 07:22

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
查看更多
成全新的幸福
3楼-- · 2020-06-30 07:24

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.

查看更多
做个烂人
4楼-- · 2020-06-30 07:29

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

查看更多
SAY GOODBYE
5楼-- · 2020-06-30 07:35

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.

查看更多
该账号已被封号
6楼-- · 2020-06-30 07:40

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

exec 2> >(grep -v "Killed by signal 1.")
查看更多
姐就是有狂的资本
7楼-- · 2020-06-30 07:42

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

查看更多
登录 后发表回答