Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

How to log ssh debug info?

Writer Andrew Henderson

I need to write the output of ssh debug info into the file. This

ssh -v > result.txt
ssh -v 2>&1 > result.txt

doesn't work, the file result.txt is empty, but on the screen i see bunch of debug lines, like:

OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 172.16.248.xx [172.16.248.xx] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
etc

Is there a way to redirect these lines to the file?

3 Answers

You have to change the order of the redirections on the command line:

ssh -v >result.txt 2>&1

or just:

ssh -v 2>result.txt
 -E log_file Append debug logs to log_file instead of standard error.
1

Apparently the best way to save this "hidden" debug output to the file is by using logsave:

logsave result.txt ssh -v 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy