This week I’m teaching out in Portland, OR in a Linux Fundamentals class. A small part of one of this weeks chapter is on screen. You might remember I’ve talked about screen in the past here. I still use screen on a day to day basis and really enjoy it. Today I’ve got something new for it that you may not have ever used.
Screen will allow you to collaborate within a session for multiple assigned users. It is also configurable to allow for read-only or read-write access on a per user basis. This, of course, if helpful if you don’t trust certain people within a collaboration as everyone will have input permissions on the screen.
Now the first step is that you’ll need to, at least temporarily, put the suid bit on the command screen. This is done using:
sudo chmod u+s /usr/bin/screen (multiuser screen below will not work without this)
Second you’ll want to create your initial screen session. You can do that (remember my original screen cheat-sheet) using a command similar to:
screen -S screen-name (naming your screen sessions with -S makes organizing and switching simpler)
Third you now allow the collaborator to connect to your machine using something like ssh.
ssh user@remote.machine
The fourth step is to set multiuser mode on within screen itself. This is done using the screen shortcuts followed by :multiuser on. Here is an example:
ctrl-a :multiuser on
You also need to explicitly allow permissions for the collaborating user (the one that ssh’d to the machine) using something like:
ctrl-a :acladd username
At this point username can connect to the shared screen using:
screen -x username/screen-name
If you want to just try it out you can test sharing screens by just using the same user account. Start screen locally using step two above. After that is up start some command or type something at the prompt. At this point open a second terminal window and type screen -x. You should have a mirror window in both terminals.
If you have any other implementations of this I’d love to hear about them. I really like this feature and can see a number of uses for it. Perhaps collaborating on code and not needing to use pastebin or something similar. Actually watching the other user work to show you examples.
It’s like remote desktop or VNC, minus the bandwidth and overhead!
Command line collaboration brought to you by GNU. What more could you want?
More permissions on advanced permissions here.