21
我需要将ssh调试信息的输出写入文件。这如何记录ssh调试信息?
ssh -v [email protected] > result.txt
ssh -v [email protected] 2>&1 > result.txt
不起作用,该文件的Result.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
有没有办法来重定向这些行文件?
在根本不必要的。这不是“隐藏”的调试信息。它是STDERR,您将重定向到STDOUT。 STDOUT就是你重定向的东西,但是你在*设置STDERR来写入STDOUT写入的同一个文件(控制台)之后就是这样做的。这就是为什么salva的答案应该起作用。 – Kat