Logging remote telnet sessions via script

Hi,

My requirement - for security purpose -
I want all root logins to my solaris servers are done by a script kept
in a separate unix box. This script will telnet into remote solaris server with
root user and log every session via log file.

Now my purpose is to log every telnet session happening through this script.
How can this be solved ?

I try to use script command, but script command only works if the user type "exit" after his session. If a user disconnect a session abruptly, it will not log anything.

Read up on the "trap" command for your script. I use it to capture exit codes and perform actions based on a specific code.

HTH

You should use expect... It's quite easy

If you're worried about security and trying to track root logins, the first thing you need to do is stop using telnet and start using ssh for remote access.

As far as tracking logins (and other events) on Solaris, that's what auditing does. Just google "Solaris audit".