Ssh – Disable SSH tunnel “open failed” messages

PROXYssh

I want to disable the "open failed" messages that appear in a SSH session when tunnelling is disable.

It interferes with my SSH session if I'm, for example, writing something in vim, then the whole screen can be filled with these messages and I have to exit vim and clear the screen for them to go away.

How do I disable these messages?:

channel 5: open failed: connect failed: Connection refused

channel 3: open failed: connect failed: Connection refused

Best Answer

ssh writes that particular message as a log message at the info level. Log messages are written to standard error by default. Ssh has options to control what is logged.

  • The configuration setting LogLevel sets the log level. Setting the level to QUIET, FATAL, or ERROR would disable the particular message which you're asking about. You can set LogLevel through the "-o" command-line option or through your .ssh/config file.

  • The "-q" command-line option sets logging to quiet. This should disable that particular message, along with virtually every other message printed by ssh.

  • The "-E file" option directs log messages to the named file instead of writing them to stderr. This option is relatively new, and may not be present in your copy of ssh.

  • The "-y" option directs log messages to syslog.

  • The "-v" option makes logging even more verbose (you don't want this).

Related Question