Problem: The company added operations manager, in order to ensure the security of the server, and when the problem is good to confirm the problem, you need to record the behavior of each server landing track.
Fix the problem: The Linux script command has such a powerful function. Meet our needs. Script logs a terminal session.
Operation Steps:
I am centos6.3 system, with script command, if not, we need to install manually.
Vim/etc/profile
Add at the end:
If [$UID-ge 1000]; Then
Exec/usr/bin/script-t 2>/mnt/log/script/$USER-$UID-' date +%y%m%d%h%m '. Date-a-f-q/mnt/log/script/$USER-$UID-' Date +%y%m%d%h%m '. Log
Fi
This allows the user to log in after the operation will be logged to/mnt/log/script/*.log (directory itself according to the server directory definition), we can be viewed through more or VI.
I'm here to record the user ID greater than 1000, you can log in to the user, manipulate some commands, view the generated files.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/EA/wKioL1WLvI-Bmp58AAN4mlzVfZg267.jpg "title=" 12.jpg "alt=" Wkiol1wlvi-bmp58aan4mlzvfzg267.jpg "/>
As you can see, the corresponding user is logged in, and a file with a log and date suffix is generated separately. Log records the operation, which can be played back through the date file. by Scriptreplay 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/6E/ED/ Wkiom1wlvebhw9gyaacx1gptvje631.jpg "title=" 1.jpg "alt=" wkiom1wlvebhw9gyaacx1gptvje631.jpg "/> Note: First" time file ", then" Command file ", do not reverse.
All records of the user's operations are completed. And there are playback functions, like video, very convenient to find problems.
This article from "Meng Sir accumulation" blog, reproduced please contact the author!
CentOS Records user behavior trajectory