I share your pain, as I used to have this same problem and in the past had written scripts to accomplish this. Today, all you need to do is use sudosh. Sudosh (an RPM) works with sudo to provide a shell that users would use for full root access, which ensures that the detailed logs are kept.
Sudosh actually records all keystrokes with the output, and can play back entire sessions like a VCR! It is very simple to set up and actually comes in two parts, sudosh and sudoshd. Sudosh is the actual program that one would call from sudo.
Related Q&A from Kenneth Milberg
Unix-to-Linux migration expert Ken Milberg describes how virtualization, support, clustering and more fit into the migration of an IT infrastructure ...continue reading
A reader new to Linux wonders about which distribution is recommended for installing Nagios and what Nahant and Tikanga mean.continue reading
Documentation for Red Hat Enterprise Linux 5 covering checking system performance, tuning, kernel configuration and extending the file system exists ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.