Giter Club home page Giter Club logo

wemux's Introduction

wemux: Multi-User Tmux Sessions Made Easy


wemux enhances tmux to make multi-user terminal multiplexing both easier and more powerful. It allows users to host a wemux server and have clients join in either:

Mirror Mode gives clients (another SSH user on your machine) read-only access to the session, allowing them to see you work, or

Pair Mode allows the client and yourself to work in the same terminal (shared cursor)

Rogue Mode allows the client to pair or work independently in another window (separate cursors) in the same tmux session.

It features multi-server support as well as user listing and notifications when users attach/detach.

How To Install

IMPORTANT: Wemux requires tmux version >= 1.6

MacPorts (on OS X)

If you have MacPorts installed you can install wemux with a very simple:

sudo port install wemux

Homebrew (on OS X)

If you have Homebrew installed you can install wemux with a fairly simple:

brew install wemux

The user that installed wemux will automatically be added to the wemux host list. To change the host or add more hosts, edit /usr/local/etc/wemux.conf and add the username to the host_list array.

Users in the host_list will be able to start new wemux servers, all other users will be wemux clients and join these servers.

$ vim /usr/local/etc/wemux.conf
     OR
$ wemux conf

host_list=(zolrath brocksamson)

Manual Installation

The rest of this readme will operate under the assumption you'll place wemux in wemux/ in your /usr/local/share directory. To make wemux available for all users, perform the following steps, using sudo as required:

Git clone this repo.

git clone git://github.com/zolrath/wemux.git /usr/local/share/wemux

Symlink the wemux file into your $PATH via /usr/local/bin/, being sure to use the full path.

ln -s /usr/local/share/wemux/wemux /usr/local/bin/wemux

IMPORTANT: Copy the wemux.conf.example file to /usr/local/etc/wemux.conf

cp /usr/local/share/wemux/wemux.conf.example /usr/local/etc/wemux.conf

Then set a user to be a wemux host by adding their username to the host_list in /usr/local/etc/wemux.conf. Users in the host_list will be able to start new wemux servers, all other users will be wemux clients and join these servers.

vim /usr/local/etc/wemux.conf
host_list=(zolrath brocksamson)

To upgrade to a new version of wemux return to the /usr/local/share/wemux directory and perform a git pull

Host Commands

wemux start

Use wemux start to start a wemux server, chmod /tmp/wemux-wemux to 1777 so that other users may connect to it, and attach to it. If a wemux server already exists, it will attach to it instead.

wemux attach

Use wemux attach to attach to an existing wemux server.

wemux stop

Use wemux stop to kill the wemux server and remove the /tmp/wemux-wemux socket.

wemux kick username

Use wemux kick <username> to kick an SSH user from the server and remove their wemux rogue sessions.

wemux config

Use wemux config to open /usr/local/etc/wemux.conf in your $EDITOR. Note this only works if you have the environment variable EDITOR configured.

wemux

When wemux is run without any arguments in host mode, it is just like running wemux start. It will reattach to an existing wemux server if it exists, otherwise it will start a new server.

Client Commands

wemux mirror

Use wemux mirror to attach to server in read-only mode.

wemux pair

Use wemux pair to attach to server in pair mode, allowing the client to control the terminal as well.

wemux rogue

Use wemux rogue to attach to server in rogue mode, which allows both editing with the host and switching to windows independently from the host.

wemux logout

Use wemux logout to remove your rogue mode session.

wemux

When wemux is run without any arguments in client mode, its behavior attempts to intelligently select mirror, pair, or rogue:

  • If the client does not have an existing rogue session it will attach to the wemux server in pair mode.
  • If the client has already started a wemux rogue session, it will reattach to the server in rogue mode.
  • If both rogue and pair mode are disabled, it will attach in mirror mode.
  • By setting default_client_mode="rogue" in wemux.conf this can be changed to always join in rogue mode, even if a rogue session doesn't already exist.

Other Commands

wemux passes commands it doesn't understand through to tmux with the correct socket setting.

wemux list-sessions is equivalent to entering tmux -S /tmp/wemux-wemux list-sessions

User List

wemux can display a list of connected users, indicating users in mirror mode with [m] at the end of their name.

If you'd like to see a list of all users currently connected to the wemux server, you have three options:

wemux users

Enter wemux users in the terminal to display a list of all currently connected wemux users.

$ wemux users
Users connected to 'wemux':
  1. zolrath
  2. csagan[m]

Status Bar

You can add the user list to your status bar by adding #(wemux status_users) where you see fit by editing your ~/tmux.conf file.

set -g status-right "#(wemux status_users)"

Display Message

If you'd rather display users on command via a tmux message, similar to the user attachment/detachment messages, you can do so by editing your ~/tmux.conf file. Pick whatever key you'd like to bind the displaying the message to. Using t as an example:

unbind t
bind t run-shell 'wemux display_users'

Note that the tmux prefix should be pressed before t to activate the command.

User listing can be disabled by setting allow_user_list="false" in wemux.conf

Short-form Commands

All commands have a short form. s for start, a for attach, p for pair etc. For a complete list, type wemux help (or wemux h)

Multi-Host Capabilities


wemux supports specifying the joining different wemux servers via wemux join <server>. This allows multiple hosts on the same machine to host their own independent wemux servers with their own clients. By default this option is disabled.

wemux will remember the last server specified to in order to make reconnecting to the same server easy. wemux help will output the currently specified server along with the wemux command list.

Changing servers can be enabled by setting allow_server_change="true" in /usr/local/etc/wemux.conf

Joining Different wemux Servers

To change the wemux server run wemux join <server>. The name will be sanitized to contain no spaces or uppercase letters.

$ wemux join Project X
Changed wemux server from 'wemux' to 'project-x'
$ wemux
$ wemux stop
$ wemux reset
Changed wemux server from 'project-x' to 'wemux'

wemux join servername

Join wemux server with specified name.

$ wemux join rails
Changed wemux server from 'wemux' to 'rails'

wemux join servernumber

Alternatively, enter the server number displayed next to the server name in wemux list.

$ wemux j 1
Changed wemux server from 'rails' to 'project-x'

wemux join

Join with no argument simply displays the current wemux server, if you're into that.

$ wemux join
Current wemux server: wemux

Resetting the Server Name

In order to easily return to the default server you can run wemux reset

wemux reset

Joins the default wemux server: wemux (or value of default_server_name in wemux.conf)

$ wemux reset
Changed wemux server from 'project-x' to 'wemux'

Active Server List

To list the name of all currently running wemux servers run wemux list

wemux list

List all currently active wemux servers.

$ wemux list
Currently active wemux servers:
  1. project-x
  2. rails
  3. wemux    <- current server

wemux join and wemux stop both accept either the name of a server or the number indicated next to the name in wemux list.

Listing servers can be disabled by setting allow_server_list="false" in /usr/local/etc/wemux.conf

Configuration


There are a number of additional options that be configured in /usr/local/etc/wemux.conf. In most cases the only option that must be changed is the host_list array. To open your wemux configuration file, you can either open /usr/local/etc/wemux.conf manually or run wemux config

Host Mode

To have an account act as host, ensure that you have added their username to the /usr/local/etc/wemux.conf file's host_list array.

host_list=(zolrath hostusername brocksamson)

Pair Mode

Pair mode can be disabled, only allowing clients to attach to the server in mirror mode by setting allow_pair_mode="false"

Rogue Mode

Rogue mode can be disabled, only allowing clients to attach to the server in mirror or pair mode by setting allow_rogue_mode="false"

Default Client Mode

When clients enter 'wemux' with no arguments by default it will first attempt to join an existing rogue mode session. If there is no rogue session it will start in pair mode. By setting default_client_mode to "rogue", 'wemux' with no arguments will always join a rogue mode session, even if it has to create it.

This can be changed by setting default_client_mode="rogue"

Default Server Name

The default wemux server name will be used with wemux reset and when allow_server_name is not enabled in wemux.conf.

This can be changed by setting default_server_name="customname"

Changing Servers

The ability to change servers can be enabled by setting allow_server_change="true"

Listing Servers

Listing servers can be disabled by setting allow_server_list="false"

Listing Users

Listing users can be disabled by setting allow_user_list="false" in wemux.conf

Kicking SSH Users

Kicking SSH users from the server can be disabled by setting allow_kick_user="false" in wemux.conf

Announcements

When a user joins a server in either mirror, pair, or rogue mode, a message is displayed to all currently attached users:

csagan has attached in mirror mode.
csagan has detached.

This can be disabled by setting announce_attach="false"

In addition, when a user switches from one server to another via the wemux join <servername> command, their movement is displayed similarly to the attach messages.

If csagan enters wemux join applepie the users on the default server wemux will see:

csagan has switched to server: applepie

If csagan returns to default server with: wemux reset users on wemux will see:

csagan has joined this server.

This can be disabled by setting announce_server_change="false"

Automatic SSH Client Modes

To make an SSHed user start in a wemux mode automatically, add one of the following lines to the users .bash_profile or .zshrc

Option 1: Automatically log the client into mirror mode upon login, disconnect them from the server when they detach.

wemux mirror; exit

Option 2: Automatically start the client in mirror mode but allow them to detach.

wemux mirror

Option 3: Automatically start the client in pair mode but allow them to detach.

wemux pair

Option 4: Automatically start the client in rogue mode but allow them to detach.

wemux rogue

Option 5: Only display the connection commands, don't automatically start any modes.

wemux help

Please note that this does not ensure a logged in user will not be able to exit tmux and access their shell. If the user is not trusted, you must perform any security measures one would normally perform for a remote user.

wemux's People

Contributors

dexterthedragon avatar elisiano avatar geeksam avatar jballanc avatar mikefe avatar nilbus avatar rubycut avatar thomasadam avatar trq avatar wwilkins avatar zolrath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wemux's Issues

New Release Please

Would you mind tagging a new release. After 2 years, I guess its about time.

potential wemux status_users bug

At my current job, we use wemux on a common pairing server that all of our devs log in to.

We have this in our shared .tmux.conf file.

set -g status-right "#(wemux status_users)"

Often times I'll have to terminals (iterm) opened to our pairing server. Each connected to different wemux sessions.

Terminal 1: wemux j developer_name1 && wemux
Terminal 2: wemux j developer_name2 && wemux

In the status bar of both terminals we see the names that should only be on the most recently connected one.

Is this an error with the line in the tmux config? or a limitation?

error connecting to /tmp/wemux-wemux (Permission denied)

Not sure if this is a wemux issue or an OS X issue, but for whatever reason I can only start wemux when the user is the owner of the socket. Putting both users in the same group and changing the group permissions of the socket does not seem to help either.

Not an issue, Question on screen shot

Sorry to make this an issue. Github fails at general topic discussions / email.

In the screenshot the terminal on the left has really cool symbols and status lines. How did you do that? Is it a special terminal? Is it some kinds of freaky UTF-8 trick? Is it a special tmux build?

Thanks.

'wemux users' not returning correct results

When invoking the u flag or the users command, I get several lines consisting of the following:

stat:invalid option -- '%'
Try 'stat --help' for more information.

Just in case, I've verified that this behavior exists across more than one installation and in different shell environments.

Detaching from server started with `wemux start` exits tmux

I am starting a server with wemux start and detaching from it using Ctrl-b,D. I expect that that should leave the tmux session running in the background. However it looks like that session gets killed upon detaching, and tmux list states that there are no servers.

How do you detach and leave the session running so that it's possible to re-attach later?

client option should appear in host help help screen

Using wemux client [command] allows a host to use wemux in client mode, however there's nothing suggesting this. I propose adding the client option to the host's help screen so new users can tell that those options exist.

Insecure socket sharing

The scenario: Sharing a development environment to pair programming:

In the "main" user, I create a wemux session:

wemux start

Now, my friend connects to my computer, via ssh, with a limited user (a sandbox user).
This guy could run wemux pair and everything works fine.
But, if he decides to give me trouble, he could run:

tmux -S /tmp/wemux new -s shared

Now, my friend has a session with my user, outside my supervision, and it doesn't appear in any of the wemux listing commands, and I'm not able to kick this guy using wemux commands. Alongside our happy pair programming session, my friend could be ruining my home folder (or worse), and it's not possible to me to know he's doing that.

send-keys command does not behave the same as with tmux

in tmux,

tmux send-keys -t 0:1.1 "foreman start" C-m

properly sends the foreman start command to the first pane of the first window of the tmux session named 0

in wemux,

wemux send-keys -t wemux:1.1 "foreman start" C-m

removes the space between "foreman" and "start", causing foremanstart to be sent to the first pane of the first window of the wemux session. This also occurs when "foreman start" is shellescaped.

`wemux` not the same as `wemux start`

In the README it says

When wemux is run without any arguments in host mode, it is just like running wemux start.

But when I run wemux I get No wemux server to attach to on 'wemux' whereas wemux start works fine. I assume I'm running it in host mode, since I added my username to the config. Is there something I'm missing?

rogue mode panes

I've just started playing with wemux and played a little with rogue mode. It seems like it'd be useful to be able to use rogue mode with panes rather than windows.

Is this already possible? Or feasible?

[suggestion] Add option to specify a "human" name when joining.

I have a separate pair account that people ssh to that joins my current wemux session.

I use ssh forced commands to force them to run a script that just runs wemux pair.

Example ~pair/.ssh/authorized_keys:

command="/Users/pairprogger/bin/pairprogger",no-port-forwarding,no-X11-forwarding ssh-rsa AAAA....

I'd like to have a human name attached to the users so when I do wemux users I can get their full name instead of the generic "pair" user.

I'd also like to be able to kick based on that human name.

I was thinking something like wemux pair --name 'Joe Cool' which would save this extra info someplace.

background session

I like to create a background session via a script in tmux with something like:

tmux new-session -s sessionName -n master -d 'cd MasterServer;./MasterServer'
tmux set-option -t sessionName remain-on-exit on
tmux new-window -t sessionName:2 -n workers -d '/home/launch.sh'
tmux set-option -t sessionName:2 remain-on-exit on
tmux new-window -t sessionName:3 -n htop -d 'htop'
tmux set-option -t sessionName:3 remain-on-exit on

How would I get wemux to do something similar so I could use the script to start it unattended but then reattach later with a wemux client rogue, for example. (Incidentally, looks like that still needs to be documented, I only saw that in the issue database and was nearly going to give up on wemux until I found issue #39 -- #23 seems to be related as well.

Manage SSH keys for a pair-programming account...

It'd be nice if I could store SSH .pub files someplace (e.g. ~/.wemux/ssh_keys/) and have a wemux command that would generate an authorized_keys file.

The individual lines should look something like this:

command="/usr/local/bin/wemux-authorized-keys",no-port-forwarding,no-X11-forwarding ssh-rsa AAAA...[rest of ssh public key]...== [email protected]

The wemux-authorized-keys script would mainly just be something like this:

#!/bin/bash

set -eu
export PATH="/usr/local/bin:${PATH}" # This makes sure tmux can be found (it's in /usr/local/bin)
exec wemux attach

This way, when someone ssh's into that account, they'll either:

  • Attach to a running wemux.
  • Get a message that wemux isn't running a sessions and be logged out.

Then you just keep all the ssh pub-keys in that directory for all the people you pair with.

Ciao!

"host_list=(brew)" after `brew install ...`

I coworker of mine is setting up a new machine (OS X Mavericks), and was getting errors trying to run wemux after installing via homebrew. When we checked the /usr/local/etc/wemux.conf, the host_list line said...

host_list=(brew)

We fixed that, and then wemux started working. Neither of us has seen that kind of problem with previous installations of wemux (on OS X Lion or earlier), so this is maybe an issue with the current release or an issue with installation on Mavericks?

Non-zero exit codes not being sent to shell, error messages going to STDOUT

I've noticed that, for instance, wemux mirror returns exit code 0 (success) and prints the error message No wemux server to mirror on 'wemux' to STDOUT rather than STDERR. Is there any chance we could see this fixed to conform to UNIX standards?

Solution

After looking at the code, I see that the exit codes are in there already. However, since they're being sent with return rather than exit, they don't actually get sent upon the termination of the program. (According to this SO answer, โ€œreturn has nothing to do with exit codes.โ€)

Error messages can be echoed to STDERR with >&2 echo.

@zolrath, would you be open to making these changes in wemux? If so, would you prefer to do it yourself, or would you like me to submit a PR?


Context

What I'm trying to do is use wemux to create a safe sandbox for other users to SSH into my machine for pair programming. I've created a new user solely for this purpose, whose .profile file consists only of the following:

wemux mirror 2>/dev/null || echo "Ryan isn't ready to pair yet!"
exit

If wemux conformed to UNIX standards, this code would work; unfortunately, the failure case (the part after ||) never runs, because wemux mirror always returns exit code 0.

Security implications

N.b. that if you consider doing this, you must separately disable users from directly executing commands on your machine via SSH (i.e., protect against ssh pair@your-machine <command>).

Add wemux specific tmux configuration.

It'd be nice if when I launch wemux that it ran a wemux-specific set of tmux commands.

That way I could do things like set the status bar to include wemux status_users and fire up a bunch of windows.

I'm thinking it should be named something like ~/.tmux-wemux.conf or ~/.wemux-tmux.conf so as to not get it confused with the /etc/wemux.conf file format.

Ciao!

Rogue mode can't handle usernames with dots in them

If the username have dots in it, then rogue mode doesn't work (can't find the window).

With a server running, when a user with . in the username (e.g. john.smith) issues wemux rogue, we get the following message:

Can't find window wemux-john

(note how there's no .smith in the window name). A window named john.smith gets created, but wemux can't find it, cause it's only searching for the text before the .

I hacked the following change in /usr/bin/wemux (added the second line to replace . with _ in the username):

...
username=`whoami`
username="${username}//./_"
...

and added the corresponding usernames (with _ replacing .) to host_list in /etc/wemux.conf and we could finally get rogue mode to work (pretty nice feature!).

Of course, the hack I present is not a real solution. Ideally, the usernames in /etc/wemux.conf are the real unix usernames. But my bash knowledge is not enough to propose a real patch.

Can wemux be used for sharing local sessions between 2 remote hosts?

I'm trying to set up a shared session in this setup:
I'm on my machine (hidden behind a router), my friend is on another machine (hidden behind another router), and we have 1 host which we can both connect to.

Can we use wemux to share a session on one of our local machines (not the common host) ?

hostname confusion

Firstly, awesome project. Thanks for the work!

However while getting it running, trying to figure out how it works etc the references to hostname are tripping me up.

You are probably to far into this to make such a change, but I think it would be very handy to new users if you refactored that out of your project and replaced it with an alternative moniker.

wemux_session, wemux_session_name or something to that effect perhaps.

While reading up on your project for instance, I assumed hostname was in reference to a server and thought there was multi-host session sharing magic built in.

[Idea] Restrict access to servers

It would be awesome for hosts to be able to define which users/groups are allowed to connect to a specific instance (instead of disconnecting users after reviewing wemux list).

Wemux wrapper to always list a server choice

I've written a wrapper for wemux that automatically gets a list of running servers and lets the user specify whether to join one of those or to start a new one. It's pretty rudimentary right now, but if enough people think it's useful, I could try to patch the option into the main project.

Have you thought about this already or is there a way to do this that I didn't see?

https://gist.github.com/2664890

Ronn Source?

I'm not seeing the source for the man page in the git repo.

Fix user group detection

There was a slight error in #43 with how it searched the groups. This caused the script to not detect groups at the beginning or end of the list due to whitespace matches.

This is fixed in #45

wemux and wemux start don't start a server

I run wemux and get this output:

wemux server started on 'wemux'.
No wemux server to attach to on 'wemux'.

Even when I run wemux start I get the same output.

Is there anything I could run to get some debugging information?

command `wemux users` will only display the same username?

By reading the README.md, I get the message that command 'wemux users' will output the users connecting to the server now. Something like:

$ wemux users
Users connected to 'wemux':
  1. zolrath
  2. csagan[m]

While, after some exam, I can't report the same output. Here is what I've done.

  1. ssh to my machine with two user: UA and UB seperately.
  2. In the UA's terminal, run wemux start;
  3. In the UB's terminal, run wemux join;
  4. In the UA's terminal, run wemux users;
    The output of wemux users is :
Users connected to 'wemux':
  1. UA
  2. UA

While, what I'm expected is :

Users connected to 'wemux':
  1. UA
  2. UB

how can i get such output?

Doesn't work with tmux 1.8?

I'm running on Ubuntu with tmux 1.8 and wemux start returns but wemux attach says there are no sessions. I see it has created a socket called wemux-wemux in /tmp but not got any further.

I notice recommended installation is using homebrew (i.e. a Mac). Is there any reasons this won't work on Linux? It's just tmux + bash right?

homewbrew install from git url failing

Tried with the URL in the home page and received the following:

$ brew install https://github.com/downloads/zolrath/wemux/wemux.rb
                                                                           0.0%Warning: Failed to create the file /Library/Caches/Homebrew/Formula/wemux.rb: 
Warning: Permission denied
########################################################                  78.2%
curl: (23) Failed writing body (0 != 737)
Error: Failure while executing: /usr/bin/curl -qf#LA Homebrew\ 0.9\ (Ruby\ 1.8.7-249;\ Mac\ OS\ X\ 10.7.3) https://github.com/downloads/zolrath/wemux/wemux.rb -o /Library/Caches/Homebrew/Formula/wemux.rb

Tried modifying to the redirect URL and still received the following:

$ brew install http://cloud.github.com/downloads/zolrath/wemux/wemux.rb
Warning: Failed to create the file /Library/Caches/Homebrew/Formula/wemux.rb: 
Warning: Permission denied
######################################################################## 100.0%
curl: (23) Failed writing body (0 != 943)
Error: Failure while executing: /usr/bin/curl -qf#LA Homebrew\ 0.9\ (Ruby\ 1.8.7-249;\ Mac\ OS\ X\ 10.7.3) http://cloud.github.com/downloads/zolrath/wemux/wemux.rb -o /Library/Caches/Homebrew/Formula/wemux.rb

$ brew install http://cloud.github.com/downloads/zolrath/wemux/wemux.rb
Warning: Failed to create the file /Library/Caches/Homebrew/Formula/wemux.rb: 
Warning: Permission denied
########################################################                  78.2%
curl: (23) Failed writing body (0 != 737)
Error: Failure while executing: /usr/bin/curl -qf#LA Homebrew\ 0.9\ (Ruby\ 1.8.7-249;\ Mac\ OS\ X\ 10.7.3) http://cloud.github.com/downloads/zolrath/wemux/wemux.rb -o /Library/Caches/Homebrew/Formula/wemux.rb

Security issue: read-only can be bypassed

as host:
wemux start => creates new bash session

as client, access denied:
wemux => attaches, cannot do anything: Client is read only

as client, bypassing read only:
wemux send "any command here" => works. command will be sent to bash session

wemux command doesn't recognize "rogue"

user@host:~$ wemux rogue
unknown command: rogue
To see a list of wemux commands enter 'wemux help'
user@host:~$ wemux help
wemux version 3.2.0
Current wemux server: wemux

Usage: wemux [command]
To host a wemux server please use one of the following:

    [s]       start: Start the wemux server/attach to an existing wemux server.
    [a]      attach: Attach to an existing wemux server.
    [k]        stop: Kill the wemux server 'wemux', delete its socket.

    [j] join [name]: Join the specified wemux server.
    [j]        join: Display the current wemux server.
    [d]       reset: Join default wemux server: wemux
    [l]        list: List all currently active wemux servers.
    [u]       users: List all users currently attached to 'wemux'
               kick: Disconnect an SSH user, remove their wemux server.

    [c]      config: Open the wemux configuration file in vi.
    [h]        help: Display this screen.
            no args: Start the wemux server/attach to an existing wemux server.
user@host:~$ sudo su -
root@host:~# cd /usr/local/share/wemux/
root@host:/usr/local/share/wemux# ./wemux help
wemux version 3.2.0
Current wemux server: wemux

Usage: wemux [command]
To connect to wemux please use one of the following:

    [m]      mirror: Attach to 'wemux' in read-only mode.
    [p]        pair: Attach to 'wemux' in pair mode, which allows editing.
    [r]       rogue: Attach to 'wemux' in rogue mode, allowing you to pair
                     and also work in other windows independent of the host.
    [o]      logout: Log out of the current wemux rogue session.

    [j] join [name]: Join the specified wemux server.
    [j]        join: Display the current wemux server.
    [d]       reset: Join default wemux server: wemux
    [l]        list: List all currently active wemux servers.
    [u]       users: List all users currently attached to 'wemux'

    [h]        help: Display this screen.
            no args: Attach to 'wemux' in rogue mode.

root@host:/usr/local/share/wemux# ls -la /usr/local/bin/wemux 
lrwxrwxrwx 1 root root 28 Mar 18 13:52 /usr/local/bin/wemux -> /usr/local/share/wemux/wemux

Is it possiable to use Command Mode -CC

In tmux I've been using Command Mode but it doesn't behave well with wemux.

Setup:

  • macOS running iterm2 with tmux integration

Replicate

  • open iterm2
  • ssh example.com -t 'wemux -CC'

Once logged in this way I appear to be able to see the current server.

$ wemux l
Currently active wemux servers:
  1. wemux    <- current server

I can not see that I'm attached.

$ wemux u
Users connected to 'wemux':
  1. 

If I use ssh example.com -t 'wemux' the integration is lost but wemux works as expected.

$ wemux u
Users connected to 'wemux':
  1. WOC\atlad003

Add check that provided username argument in kick is indeed a user

Major issue with lack of validation on kick

If the user enters a number to kick a user, the kill command might still catch sshd when the number is present in the ps and kill tons of ssh sessions unintentionally :(

Example

Note the first PID returned from the kick search string!

~# ps aux | grep "2.*sshd"
root     21922  0.0  0.2  41996  1276 ?        Ss   22:28   0:00 /usr/sbin/sshd
root     21926  0.0  0.7  65520  3548 ?        Ss   22:29   0:00 sshd: user1 [priv]
user1    21928  0.5  0.3  65648  1848 ?        S    22:29   0:01 sshd: user1@pts/0
root     21999  0.0  0.7  65520  3536 ?        Ss   22:29   0:00 sshd: user2 [priv]
user2    22001  0.5  0.6  67284  3376 ?        S    22:29   0:01 sshd: user2@pts/1
user2    22173  0.0  0.2   8680  1052 pts/2    S+   22:33   0:00 grep 2.*sshd
~# ps aux | grep "2.*sshd" | grep -v grep | tr -s ' ' | cut -d ' ' -f 2
21922
21926
21928
21999

wemux kick <user> fails

Output from wemux kick says:
Kicking userx from the server. Sudo required.
userx kicked successfully!

However userx still shows up in the 'wemux users' list

' sudo wemux kick userx' also fails saying:
unknown command: kick
I think because the wemux session isn't being hosted by root and the kick command is only available inside a session since 'sudo wemux help' shows a different set of commands available.

Add ability to specify groups that can start servers

Having to modify the host_list can be troublesome on a large multi-tenant machine. Allowing entire groups of users, say admin or wemux to create servers is a much simpler approach.

I'm attaching a PR that adds this ability.

Feature request: option to not open new tab when connecting

When colleagues join my wemux session, they need to switch to my wemux tab, or close their new wemux tab. If that feature could be disabled in wemux.conf, they would not actually need to remember any wemux commands at all, but instead be dropped straight into my neovim instance, which would be much easier for them.

Hence the feature request: a client option 'open_tab_for_new_connections', which defaults to true to match the current behaviour.

Packaging help.

Hi,

I'm packaging wemux into Fedora.

Can you provide me a standard tarball of the lastest version(2.2? 3.1?)?

Thanks.

wemux users only returns root

The system I am stuck working on is Solaris 10.

As the title states, when listing users attached to the server the entire list is always:

homerville:{calculoid} $ wemux users
Users attached to 'wemux':
  1. root

This also has the effect that I can't kick anyone. I sniffed around in the script and see that the result is coming from the line:

name=``stat -c%U $tty 2>/dev/null``

It only returns root on my system. I assume this is a solaris thing, because it always is if something is weird.

When I check tty on the command line and then check the owner of the pts returned it is always root.

homerville:{calculoid} $ tty
/dev/pts/20
homerville:{calculoid} $ ll /dev/pts/20
lrwxrwxrwx 1 root root 29 Feb 25  2008 /dev/pts/20 -> ../../devices/pseudo/pts@0:20

Checking a little further shows that /dev/pts/ is filled with symbolic links owned by root that point to files owned by the user they were created for:

homerville:{calculoid} $ ll -L /dev/pts/20
crw--w---- 1 calculoid tty 24, 20 Oct 30 12:10 /dev/pts/20

Announcements that a particular user is joining or leaving the server work correctly.

client options not available for hosts

Once I add my user to the host list, the wemux script will only accept host options. Thus, I am no longer able to join a session in rogue mode.
I would like to share some sessions with other terminals or machines from where I am logged in, and keep some separate.

Allow specifying the server with start, attach, pair, mirror, etc.

The commands that connect to a sessions (or start a session) should all take an argument for the session name.

e.g. wemux start mouse should be the same as wemux join mouse && wemux start.

The commands that should take a second argument should be:

  • start
  • stop
  • attach
  • mirror
  • pair

Ciao!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.