Linux Programmer | RHCE | RHCSA

Search This Blog

Tuesday, 21 May 2019

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.

MIG - NVIDIA

The new Multi-Instance GPU (MIG) feature allows GPUs (starting with NVIDIA Ampere architecture) to be securely partitioned into up to seven ...