Shell session output to screen and file

Hi

I've been reading and playing and reading and playing and still can't crack this puppy.

Basically, I would like for the contents of a users session to be logged to a file (and screen so they can see what they are doing).

I started with 'script' but got stuck when trying to exit the 'script' command and the shell at the same time.

Then I tried with output redirection but only managed to get one or the other redirected.

Any ideas guys?

Cheers in advance

Message was edited by:

bashdem

[552 byte] By [bashdem] at [2007-11-26 11:52:24]
# 1
http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9u5?a=view
alanpae at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 2

Ok, I have seen some suggestions using the tee command but I want not only the commands run but also the output all logged to a file.

ie. I need the whole input and output of a users session logged to a text file. From the moment they log in to the moment they close their shell session.

Cheers

bashdem at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 3

Hi

> I started with 'script' but got stuck when trying to

> exit the 'script' command and the shell at the same

> time.

The best way to capture the shell session is to use "script" command. I think you will not find any problem in using it. Type "exit", to come out of it.

And also, you can use expect to store complete session details in a file and thatcan be reused.

HTH,

Prabu.S

senthilprabus at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 4
Well, in that case you'd need something which is started at login time. Perhaps you should take a look at Solaris Auditing? http://docs.sun.com/app/docs/doc/816-4557/6maosrjoi?a=view .7/M.
mAbrante at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 5

script works perfectly but I cannot see how I can make the use of it invisible to the user. I can put script in their .profile but I have to ask them to type exit twice to exit 'script' AND their shell. I am looking for a way to make the one 'exit' command close 'script' AND their shell session.

bashdem at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 6

Soalris Auditing looks good but will this record the output of commands as well as the command run?

I'll elaborate a bit more. The network guys here use a solaris box to log onto routers/switches etc etc. They need an audit trail for each time they log onto the solaris box. ie a text file that shows what commands they ran and the output. so we can see what was done to a router and what condition ports were in when this command was run. etc etc.

I think script will be best but its making it invisible thats the problem.

bashdem at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 7

two thoughts come to mind.

Years ago I demo'ed a product from "Symark" called PowerBroker. It will capture keystrokes of defined users and store them to a file. It was a little over-kill for my needs.

Also, what if you were to simply alias "exit" to perform "exit; exit". In theory this would give you the double hit of "exit" in a single command. <edit>(Need to work on this....Don't work as planned)<edit>

Message was edited by:

Lee_McCreery

Lee_McCreery at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...
# 8
When you invoke script, execute it as "exec script".That will convert the current shell into a script process instead of executing script in a new process. That way theres no second process to exit.
robertcohen at 2007-7-7 12:08:22 > top of Java-index,General,Talk to the Sysop...