I need to write the output of ssh debug info into the file. This
我需要将ssh调试信息的输出写到文件中。这
ssh -v root@172.16.248.xx > result.txt
ssh -v root@172.16.248.xx 2>&1 > result.txt
doesn't work, the file result.txt is empty, but on the screen i see bunch of debug lines, like:
不工作,文件结果。txt是空的,但是在屏幕上我看到了一些调试行,比如:
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?
是否有办法将这些行重定向到文件?
2 个解决方案
#1
36
You have to change the order of the redirections on the command line:
您必须更改命令行上重定向的顺序:
ssh -v root@172.16.248.xx >result.txt 2>&1
or just:
或者是:
ssh -v root@172.16.248.xx 2>result.txt
#2
-3
Apparently the best way to save this "hidden" debug output to the file is by using logsave:
显然,将这个“隐藏”的调试输出保存到文件的最好方法是使用logsave:
logsave result.txt ssh -v root@172.16.248.xx
#1
36
You have to change the order of the redirections on the command line:
您必须更改命令行上重定向的顺序:
ssh -v root@172.16.248.xx >result.txt 2>&1
or just:
或者是:
ssh -v root@172.16.248.xx 2>result.txt
#2
-3
Apparently the best way to save this "hidden" debug output to the file is by using logsave:
显然,将这个“隐藏”的调试输出保存到文件的最好方法是使用logsave:
logsave result.txt ssh -v root@172.16.248.xx