How to record linux ssh terminal output and replay it for all users

How to record linux ssh terminal output and replay it for all users

we can get it done using script command .you can save all the session from all users login in to your server and there activity. this will help you to troubleshoot the issues .

1-  edit the profile file ( /etc/profile )and insert the below code.

……………………………………………………
if [ "x$SESSION_RECORD" = "x" ]
then
timestamp=$(date +%d-%m-%Y-%T)
session_log=/var/log/session/session.$USER.$$.$timestamp
SESSION_RECORD=started
export SESSION_RECORD
script -t -f -q 2>${session_log}.timing $session_log
exit
fi
……………………………………………………
2- create a directory to record session

Read more