Record SSH terminal of some user in Linux


Record you terminal's stdin/stdout to a server.

You can use script command to record all the activity on terminal.

Consider using script command
 
$ script <output_filename>
 
and then ssh to your server, once you are done close your ssh connection and 
$ exit
 
to stop the screen recording.
You could make sure your recordings are always named uniquely by using the following convention,

$ script filename_(date +"%Y-%m-%d%H%M%S")

you can add this line in users .bashrc.
or you can create bash script for this,

for e.g.

create one bash script named, recording.sh
 
#!/bin/bash
_ck=`ps -ef | grep -i script | grep -v grep | grep -i filename`
if [ ! -n "$_ck" ]; then
        echo "running" >>/tmp/.purval
        script filename_$(date  +"%Y-%m-%d%H%M")
fi
 
 
for e.g. script is located in users home folder. i.e. $HOME/recording.sh
you can call the script into .bashrc.

Comments

Popular posts from this blog

Error while connecting RDP "an authentication error has occurred the token supplied to the function is invalid".

Windows shared network printer issue in ubuntu 18.04

Rename printer from command line in ubuntu.