如何记录ssh调试信息? [英] How to log ssh debug info?
本文介绍了如何记录ssh调试信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将ssh debug信息的输出写入文件。这个
I need to write the output of ssh debug info into the file. This
ssh -v root@172.16.248.xx > result.txt
ssh -v root@172.16.248.xx 2>&1 > result.txt
不起作用,文件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?
推荐答案
您必须在命令行中更改重定向的顺序:
You have to change the order of the redirections on the command line:
ssh -v root@172.16.248.xx >result.txt 2>&1
或只是:
ssh -v root@172.16.248.xx 2>result.txt
这篇关于如何记录ssh调试信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文