re: How to keep a process running even after closing SSH connection? VIEW POST

re: I would recommend looking at tmux as an alternative.

Indeed tmux has simpler keyboard shortcuts, maintains window arrangement while connecting/disconnecting sessions, and uses a unix socket to control the session so giving another user access to the session is as simple as doing chown or chmod on the socket 'file'. Letting two users share a screen session is a bit of a nightmare.


Screen also uses sockets. You can see your sockets with screen -ls. IIRC, the sockets should be under /var/run/screen.

While tmux is thrown around a lot, I've found screen to be more stable and mature. Also it can be configured pretty extensively. Just see the customization done by GRML distribution. It runs screen on every TTY by default. See an example here.

Screen does use sockets, but AFAIK there's not an option to "attach to this socket". With tmux it's just 'tmux -S /path/to/socket'. I've found this very useful for sharing a terminal while doing remote support with family/friends. I had done this via screen previously and it was significantly more effort (and involved screen's internal permissions system: wiki.networksecuritytoolkit.org/in...)

Compare the "easy 6 step" process described on the screen wiki with the following in tmux:
$ tmux -S /tmp/shared_socket # start the session using the named socket file
$ chmod 777 /tmp/shared_socket # grant any user on the system access to the socket
$ # that's it. Now the other user can use tmux -S /tmp/shared_socket to connect with full read/write access. Want to give only read access? then give them permission 6 instead of 7. Want to limit to less than all users? Then use chown, setfacl, etc.

Both can be configured extensively and launched/controlled via scripts. Both can be set as default on a tty. I find the tmux config file to be a lot easier/straight forward.

How exactly are you defining "more stable and mature"?

While I think tmux is easier to use (the config file structure and default key bindings make more sense to me), the #1 selling point for me with tmux is that if I split the screen 6 ways and detach, when I re-connect (from any device), the screen is still split 6 ways. With screen all 6 windows are still running, but I have to re-arrange them into a 6-way split again.


That definitely sounds interesting! Thanks for sharing! I will be checking tmux and possibly switch to it if it works better than screen.

Forgot to upload the image:


Code of Conduct Report abuse