Problem(Abstract)
I Need to monitor commands entered in a remote TTY
or PTY session and echo those commands back to the terminal I am
currently logged into (or to a file)
Resolving the problem
The portmir command allows one TTY stream
(monitor) to attach to another TTY stream (target) and monitor the user
session that is taking place on that stream. This is accomplished by
pushing a special "mirror" module into both the target and monitor TTY
streams.
This type of monitoring can be accomplished with TTY or PTS devices.
The following example include the use of the "script" command to
collect and store the commands issued on the device being monitored.
Example: Device to monitor is /dev/pts/3
Example: Target device is /dev/pts/2
The -t is for target device. The -m is for the device to be monitored.
View the /tmp/portmir.out file for script output.
1. Look for the user's login device which is to be monitored.
# who -u <enter>Example: Device to monitor is /dev/pts/3
2. Look for the device you are currently using. This will be the "target" device.
# tty <enter>Example: Target device is /dev/pts/2
3. In your pts/2 target session, start the script command to record output to the file called "/tmp/portmir.out"
# script /tmp/portmir.out4. Begin the portmir monitoring
# portmir -t /dev/pts/2 -m /dev/pts/3 <enter>The -t is for target device. The -m is for the device to be monitored.
5. Break out of script using exit
# exitView the /tmp/portmir.out file for script output.
0 blogger-disqus:
Post a Comment