如何记录 ssh 调试信息?

2024-05-14

我需要将 ssh 调试信息的输出写入文件中。这

ssh -v [email protected] /cdn-cgi/l/email-protection > result.txt
ssh -v [email protected] /cdn-cgi/l/email-protection 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

有没有办法将这些行重定向到文件?


您必须在命令行上更改重定向的顺序:

ssh -v [email protected] /cdn-cgi/l/email-protection >result.txt 2>&1

or just:

ssh -v [email protected] /cdn-cgi/l/email-protection 2>result.txt
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何记录 ssh 调试信息? 的相关文章

随机推荐