Score:0

How log commands executed by user

cn flag

First at all, I have working some years with snoopy and it's not what I need, also checking history file isn't a solution for me.

I have to give ROOT access to a developer to install a program on the server and I know that he will remove history after he exits session.

I need to check what commands he ran to protect server from abuse activity.

Any solution to logging commands?

Score:1
pe flag

You can log all the activity from the users with the psacct package.

  • The psacct package contains several utilities for monitoring process activities, including ac, lastcomm, accton and sa.

  • The ac command displays statistics about how long users have been logged on.

  • The lastcommcommand displays information about previous executed commands.

  • The accton command turns process accounting on or off.

  • The sa command summarizes information about previously executed commands.

Installation on RHEL/Fedora/CentOS

# yum install psacct

Installation on Ubuntu/Debian

$ sudo apt-get install acct

OR

# apt-get install acct

In RHEL type the following commands to create /va/account/pacct file and start the service

# chkconfig psacct on

# /etc/init.d/psacct start

In Suse type the following commands to create /va/account/pacct file and start the service

# chkconfig acct on

# /etc/init.d/acct start

Display commands executed by USER

$ lastcomm [USER]
George Y avatar
vn flag
This is barely useful. It will only log the main commands not arguments. i.e. `rm` will tell you nothing which file the user deletes.
Score:1
cn flag

I have to give ROOT access to a developer to install a program ...

No, you don't.
Get them to write down or, better yet, script the installation steps and execute them on their behalf.
This is called Separation of Duties. They are a Developer. You are a SysAdmin. Let them do the stuff that they're good at (writing code, testing, etc.) and you do the stuff that you're good at (keeping machines secure and running efficiently, etc.).

... I know that he will remove history after exit session.

Is this "standard practice" for your organisation? If not, why do they feel the need to do so?

I need to check what commands he run to protect server from abuse activity.

It is clear that you do not trust this Developer.
If that is the case, then you should not let them anywhere near this server.
It's your job on the line if you allow them to install something questionable on there.

Escalate the issue to Management if necessary.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.