Mirroring session (TTY) on AIX using portmir

Sometimes we want to see the screen of the session of another user in, order to solve any problem remotely. Portmir is an interesting AIX’s command and help us to achieve this.
Portmir is part of bos.sysmgt.serv_aid filand filesetis and it’s shipped on AIX OS.

What is portmir?

From man page:
Description

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.

Let see how portmir works with examples.

Users loggued on the system:

[root@lpar:/] who
root        pts/0       Nov 17 16:39     (pc1.domain.net)
israel      pts/1       Nov 21 16:23     (pc2.domain.net)
pepe        pts/2       Nov 21 16:24      (pc3.domain.net)

So, let’s mirror the TTY of user ‘israel’. Just type:

[root@lpar:/] portmir -t pts/1

portmir: Remote user connected, mirroring active.

On ‘israel’ session appears:

[root@lpar:/]
portmir: Remote user connected, mirroring active.

So, now root user can write on ‘israel’ session if needed. But user ‘israel’ also can write on its session and will be observed by root.
Once root finished to solve the problem, from any session type:

[root@lpar:/] portmir -o

portmir: Mirroring is stopped.

But only root or any user from similar provilegde can use portmir. If a non-root user try to portmir another user, it gets this error:

[israel@lpar:/]  portmir -t pts/2

portmir: Cannot open /home/anotheruser/.mir: A file or directory in the path name does not exist.

Another use of portmir is that you can send ‘portmir’ session to another user. Let’s see this example.
We’re going to send output from portmir of user ‘israel’ to user ‘pepe’. Here pts/1 if TTY of user ‘israel’ and pst/2 is TTY of user ‘pepe’

[root@lpar:/]  portmir -t pts/1 -m pts/2

portmir: Remote user connected, mirroring active.

Now, root user can continue working without impact on another sessions, but everything ‘israel’ do on its session will be shown on ‘pepe’s session.
To disable mirroring just type this command in any of ‘israel’ or ‘pepe’s session.

[israel@lpar:/]  portmir -o
portmir: Mirroring is stopped.

Just thanks if the post was helpful

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Tunneling With SSH to Your Destination
Viewed 4586 times since Wed, May 30, 2018
AIX 6.1: Extend VG 0516-1714 extendvg 0516-1254 extendvg
Viewed 4687 times since Fri, Jul 6, 2018
Processes and Devices—It’s All About the Children
Viewed 2416 times since Wed, May 30, 2018
AIX, Networking↑ Adding and deleting a static network route using the command line
Viewed 2914 times since Fri, Apr 19, 2019
AIX alt_disk_copy
Viewed 10072 times since Sun, Jun 30, 2019
Epoch & Unix Timestamp Conversion Tools
Viewed 63260 times since Fri, Jun 22, 2018
AIX: Error code 0516-1339, 0516-1397 0516-792: cannot extendvg with a previous Oracle ASM disk
Viewed 3966 times since Wed, Feb 6, 2019
AIX - How to get CPU infomation
Viewed 6091 times since Fri, Jun 8, 2018
AIX: How to identify the program listening in the given port
Viewed 2636 times since Mon, Jun 11, 2018
How to Maintain a Virtual I/O Server With FBO Part II
Viewed 10760 times since Wed, Jun 5, 2019