17

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

1 Answer 1

23

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

2
  • 3
    And the ssh command line can be altered without exiting the session. Entering the ssh cli mode with <enter> followed by ~C and typing -q into the ssh> prompt followed by another <enter>. Makes the messages go away in an already open session. Nov 4, 2020 at 13:29
  • 1
    Thanks, @Evgeny ! note that since more recent versions (OpenSSH 9.2, 2023), the ~C cli mode is disabled by default and you need to config ssh with EnableEscapeCommandline yes (or, on the cmd line, ssh -h EnableEscapeCommandline=yes). Details in someone's blog post and documented in OpenSSH change notes May 10 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .