I'm feeling that some people are using the root, how i can log all commands and connections times including ips made to the server (ssh) from all users?
history command is not enough
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Root is root. Anything you do to try to keep track of root usage can be subverted or circumvented by someone who has root; even if you cause bash to pipe all history file entries to syslog on a secured remote server, for example, your system is only safe until the badly-behaved user figures out what you've done and disables or works around it.
This is a social problem, not a technical one. You need to implement a policy that will prevent people from using root, and put in place system checks to ensure that only acceptable access is granted, in a monitored and logged environment.
Hope this helps - good luck.
well you could just send yourself an email saying that "Elvis" entered the building
In the .bashrc put this
echo 'ALERT - Root Shell Access (YOURSERVERNAME) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" YOUREMAIL
So every time the user root logs in you will be notified
BSM audit logs will help in tracking user commands and events
whowatch tool is also helpfull
The following version of OpenSSH allows you to monitor all keystrokes which pass through the SSH daemon. My organization (Lawrence Berkeley National Laboratory) uses this code internally to support our science research environments, with great success.
A version of OpenSSH designed for high security installations where it is desirable to audit user activity. To do this we modify the SSH daemon to export information about user names, authentication, keystrokes, file transfers, remote command execution and a variety of SSH related metadata in as agnostic a way as possible. As an addition to this project, we provide infrastructure via the Bro Intrusion Detection System. The most general idea here is that a site can generate local security policy in the Bro scripting language and monitor in near real time user activity.
As long as it doesn't get subverted process accounting can yield useful information.
Disabling the root password will prevent use of
su to become root.
A periodic scan of
su processes should show when su is being used.
auth.log or its equivalent might be useful for detecting who is becoming root.