CentOS Records user behavior trajectory

Source: Internet
Author: User
Tags linux script command

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:

    1. I am centos6.3 system, with script command, if not, we need to install manually.

    2. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.