[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Monitor CentOS root activity through SSH

Posted on 2014-03-06
5
Medium Priority
?
980 Views
Last Modified: 2014-03-14
Hello,

I have a contractor working on a server and using root access. Right now I have imperfect solution of using 'tail -f /root/.bash_history' > log.txt through ssh. I need to have a live streaming record of all system calls and terminal commands for the root activity on a remote server through ssh.

Thanks!
0
Comment
Question by:Sanction
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 29

Accepted Solution

by:
Jan Springer earned 2000 total points
ID: 39910983
Require that he use "sudo" and update the sudoers file to allow him to run any command as sudo root without requiring a password.  Identify the log file in sudoers to log all commands and be sure to create an exclusion where he cannot read or write to this log file.
0
 
LVL 1

Expert Comment

by:Reza_a
ID: 39911051
You can enable audit, and then specify what sort of commands, system calls you need to log. There are some good commands for analysing those logs then.

But be aware that audit may generate huge log file depends on level that you are monitoring.
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39912224
use the "ForceCommand" option in sshd_config to run a custom script that does what you expect or an existing tool such as rootsh.

if you redirect the output to an append-only file, or better a remote syslog, it will be quite difficult to bypass it without you noticing, even as root
0
 

Author Comment

by:Sanction
ID: 39914256
All good solutions! The only concern I have left is executing commands over ssh (ex. ssh user@server 'sudo bash -s' < local_script.sh) Any idea on how to restrict remote script execution and force the user to use shell to input all of the commands?
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39928787
yes, use the "ForceCommand" option in ssh config file (see above)

also note that logging in sudo is absolutely trivial to bypass and is often bypassed accidentally by people who type "sudo sh" (which is roughly equivalent to "su") when they need to work as root so they just don't have to type sudo on evry line afterwards
0

Featured Post

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question