Tips | Sunday, July 1, 2012

Session Sharing with another User on *NIX and Windows

By: Giri Mandalika | Principal Software Engineer

Oracle Solaris

Since Solaris is not widely known for its graphical interface, let's just focus on sharing a terminal session in read-only mode with another user on the same system. Here is an example.


% finger
Login Name TTY Idle When Where
root Super-User pts/1 Sat 16:57 dhcp-amer-vpn-rmdc-a
sunperf ??? pts/2 4 Sat 16:41

In this example, two users root and sunperf are connected to the same system from two different terminals pts/1 and pts/2 respectively. If the root user wants to show something to sunperf user -- what s/he is doing in her/his terminal, for example, it can be accomplished with the following command.

script -a /dev/null | tee -a <target_terminal>


# script -a /dev/null | tee -a /dev/pts/2
Script started, file is /dev/null
# uptime
5:04pm up 1 day(s), 2:56, 2 users, load average: 0.81, 0.81, 0.81
# isainfo -v
64-bit sparcv9 applications
crc32c cbcond pause mont mpmul sha512 sha256 sha1 md5 camellia kasumi
des aes ima hpc vis3 fmaf asi_blk_init vis2 vis popc
32-bit sparc applications
crc32c cbcond pause mont mpmul sha512 sha256 sha1 md5 camellia kasumi
des aes ima hpc vis3 fmaf asi_blk_init vis2 vis popc v8plus div32 mul32
# exit
Script done, file is /dev/null

After the script .. | tee .. command, sunperf user should be able to see the root user's stdin and stdout contents in her/his own terminal until the script session exits in root user's terminal. Since this kind of sharing is based on capturing and redirecting the contents to the target terminal, the users on the receiving end won't be able to see whatever is being edited on initiators' terminal [using editors such as vi]. Also it is not possible to share the session with any connected user on the system unless the initiator has the necessary permissions and privileges.

The script utility records everything printed in a terminal session, while the tee utility replicates the contents of the screen capture on to the standard output of the target terimal. The tee utility does not buffer the output - so, the screen capture from the initiators' terminal appears almost right away in the target terminal.

Though I never tested, this technique may work on all *NIX and Linux flavors with little or no changes. Also there might be other ways to accomplish this.

[Thanks to Sujeet for sharing this tip]

Microsoft Windows

Most of the Windows users may rely on VNC services to share a desktop session. Another way to share the desktop session is to use the Remote Desktop Connection (RDC) client. Here are the steps.

  • Connect to the target Windows system using Remote Desktop Connection client
  • Launch Windows Task Manager
  • Navigate to the "Users" tab
  • Find the user session that you want to connect to and have full control over as the other user who is currently holding that session
  • Select the user name in Windows Task Manager, right click and choose the option "Remote Control"
  • A window pops up on the other user's session with the message "<USER> is requesting to control your session remotely. Do you accept the request?"

Once the other user says "Yes", you will be granted access to that session. Since then both users should be able to see the same screen and even control the session from their respective workstations.

Join the discussion

Comments ( 2 )
  • guest Tuesday, February 12, 2013

    Another option would be to write to a file using the -f flag (to avoid large buffers):

    script -f /tmp/some_file

    set the read permits of that file accordingly and the all other would have to use:

    tail -f /tmp/some_file

    to follow the session.

  • Sergey A Belous Wednesday, March 13, 2013

    I have written Windows Desktop Workspace Manager with automated terminal for CYGWIN. Every terminal window has built-in TELNET or TELNET-TLS server that allows to share terminal session in the text mode via TELNET (no streaming bitmap pixels between computers as in VNC).

    Check it out:

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Visit the Oracle Blog


Contact Us


Integrated Cloud Applications & Platform Services