[英]How to log ssh debug info?
我需要將 ssh 調試信息的輸出寫入文件。 這
ssh -v root@172.16.248.xx > result.txt
ssh -v root@172.16.248.xx 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 root@172.16.248.xx >result.txt 2>&1
要不就:
ssh -v root@172.16.248.xx 2>result.txt
-E log_file
Append debug logs to log_file instead of standard error.
顯然,將此“隱藏”調試輸出保存到文件的最佳方法是使用 logsave:
logsave result.txt ssh -v root@172.16.248.xx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.