Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Recording shell session from login to exit

Posted on 2007-11-21
2
Medium Priority
?
1,607 Views
Last Modified: 2013-12-16
I've found a nifty little program called ttyrec which will record a shell session to playback later.

I have a developer that I need to allow to login as root on a virtual server in order to install some packages for a project he developed for me.

I want to use ttyrec to record his session so that if I need to reinstall the packages at a later time I'll have a record of everything he did.

ttyrec executes and simply returns back to the command prompt while sitting between bash and the terminal. Typing "exit" will terminate the ttyrec session and return the user to a regular unrecorded shell.

How can I setup ttyrec to start recording when my developer logs in and stops recording when he logs out?

Do I need to replace the shell in /etc/passwd with a script which includes ttyrec or is it better to put this in .bash_profile or some other method?  Details would be appreciated.

Also, on the line used to initialize ttyrec, I need to pass a filename to save the recording as.  I need to use a backtick shell reference in order to generate a unique filename for each login so that previous files are not overwritten by new files.

0
Comment
Question by:phasevar
2 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 20332148
In the user's .bash_profile, put something like

exec /path/to/ttyrec log-$(date +%Y%m%d-%H%M)

That will create a log file in the form

log-YYYYMMDD-HHMM
0
 

Author Comment

by:phasevar
ID: 20332790
Perfect!  Thanks!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

971 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