Ssh

遠端主機上的 BASH shell 會話記錄

  • March 26, 2019

將 BASH shell 會話記錄到主機上的文件的最佳方法是什麼?

首選輸出格式相當於 PuTTY 的“可列印輸出”日誌設置,使用者可以查看包括輸入和排除 ncurses 控製字元數據。

可能值得查看 shell 或系統審計程序,如rootshsudosh

您可以啟動gnu screen並使用日誌功能。我不知道有什麼東西會給你一個非常好的ncurses應用程序日誌,比如top。

log [on|off]

Start/stop writing output of the current window to a file "screenlog.n"
in the window's default directory, where n is the number of the current
window. This filename can be changed with the `logfile' command. ...

logfile filename
logfile flush secs

Defines the name the log files will get. The default is "screenlog.%n".
The  second  form changes the number of seconds screen will wait before
flushing the logfile buffer to the file-system. The default value is 10
seconds.

引用自:https://serverfault.com/questions/25595