How to log all ssh sessions?
By Sarah Rodriguez •
I'm Ubuntu 18 user for some days. Previously I used Putty in Windows and it logs all my commands in SSH: Documents/Logs/2018-11-01_20-00-03_sshserver.log etc.
Now I need to setup logging in Ubuntu terminal too because I'm using terminal (putty doesn't know copy/paste to another app/window).
Can anybody tell me how to turn on logging?
Thank you very much.
51 Answer
You could use the script command. Read man script.
script my.log
ssh A A stuff exit # on A
ssh B B stuff exit # on B
exit # end of script my.log 2