Hide SSH Terminal Script From User
Hello,
I am running the following script in /etc/bashrc to automatically record all terminal sessions to file on my server. (I regularly use contractors to install new scripts on my server, and have run into problems in the past where they have also installed disruptive scripts that redirect users, or other malicious scripts. I am hoping that by recording their activities, I can detect any malicious activities before they cause any harm). test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f $HOME/$(date +"d-b-%y_%H-%M-%S")_shell.log) When a user first logs in to my Linux server by ssh, they see the following: Script started, file is /root/11-Oct-15_18-38-22_shell.log My question is, is there any way to run this script without the user being notified that the script has been started? Or perhaps another script that achieves the same without notifying the user? Thanks for the help. |
Figured it out. In case anyone else wants to do the same, simply add -q into the original command:
test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f -q $HOME/$(date +"d-b-%y_%H-%M-%S")_shell.log) |
You might want to let them know at some point that everything they do is recorded (just a imo)
You can also do this to redirect stdout/err messages Code:
(command; command2) &> /dev/null |
All times are GMT -5. The time now is 11:16 PM. |