Share an interactive ssh session b/n two users with ‘tmux’

I recently started using tmux, a terminal multiplexer much similar to GNU screen(which I still use on a lot on RHEL machines). Personally, I find tmux more elegant and less cryptic while configuring. Specially, sharing interactive(or read-only) ssh sessions w/ remote folks for debugging is very trivial.

Get it:

  $ yum install tmux -y   

Create a tmux session(let’s say on testbox1) by specifying path to a socket(its name can be anything)to be used:

 $ tmux -S /var/tmp/share-ses 
# Where -S is the absolute path to the server socket.

Now, to share the above created session w/ a remote user, ask the person to ssh into testbox1, and then try the below for sharing a session interactively or read-only mode:

  • Read/Write session, so that both users can interactively edit on the shell:
  •  $ tmux -S /var/tmp/share-ses attach 
  • For ‘Read-Only’ session(for remote user) :
  • $ tmux -S /var/tmp/share-ses attach -r 
    # Where r is 'read-only' mode for the remote user,
    # so he/she can just 'watch' the session.

To detach from the session: $ tmux detach (or use the binding — Ctl+b d when in ‘read-only’ mode)



Filed under Uncategorized

3 responses to “Share an interactive ssh session b/n two users with ‘tmux’

  1. You can do the same thing with screen. If you run:

    screen bash

    And then have the second (or third, or fourth) user run screen -x they will share your bash session.

    • Scott:
      Right. Been using ‘screen’ since a couple of years. This is just a preference, that’s all. Just to note, window/layout splitting/session management is a little more convenient in tmux.

  2. Pingback: Links 20/8/2011: Linux Graphics Survey, Firefox 7 Beta | Techrights

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s