zolrath / wemux Goto Github PK
View Code? Open in Web Editor NEWMulti-User Tmux Made Easy
License: MIT License
Multi-User Tmux Made Easy
License: MIT License
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?
Is there any way to get an indicator in the status bar to show what window the other person is on (when working in rogue mode).
$ 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
$ 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
Hi,
I'm packaging wemux into Fedora.
Can you provide me a standard tarball of the lastest version(2.2? 3.1?)?
Thanks.
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?
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.
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?
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?
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.
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>
).
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?
I'm not seeing the source for the man page in the git repo.
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?
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
Would you mind tagging a new release. After 2 years, I guess its about time.
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.
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!
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.
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.
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 :(
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
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?
can there be support for ubuntu?
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.
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.
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?
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?
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.
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.
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) ?
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?
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.
currently, as soon as i give a user permission to host a session, they are able to join every other session on pair mode. i'd like to be able to restrict users so they can join sessions owned by others in mirror mode, but still host their own sessions they can invite others to.
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.
Should either check current working directory or be configurable via environment variable.
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.
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:
Then you just keep all the ssh pub-keys in that directory for all the people you pair with.
Ciao!
In the README it says
When
wemux
is run without any arguments in host mode, it is just like runningwemux 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?
Where can I see logs?
sudo wemux start
sudo wemux stop
No wemux server to log out of on 'wemux'.
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.
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.
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.
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
).
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!
Hi,
I was wondering - would you mind telling me which colorschemes you were using for vim and your terminal, when taking the screenshot on https://github.com/zolrath/wemux/blob/master/README.md?
Thanks in advance.
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
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.
In tmux I've been using Command Mode but it doesn't behave well with wemux.
Setup:
Replicate
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
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.
wemux should check to see if the folder specified in socket_prefix exists and, if not, it should to create it. This allows for easier cleanup and management of large number of sockets.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.