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.
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.
Actually, you should use dpkg-statoverride if you’re going to permanently change a file’s permissions that’s under package control. Otherwise, when the package is updated or reinstalled the permissions will get reverted back to their standard states.
So for screen it’d look like:
sudo dpkg-statoverride –add –update root utmp 6755 /usr/bin/screen
You can also get text-session collaboration with the kibitz command. That is actually an Expect script, and I think it usually installs with Expect. This might be considered a minus. A big plus is that it does not require the SUID bit. I have used it several times, and I think it works great.
I have found that it is a good idea for both users to have the same terminal height and width set before using kibitz; of course, the same might be true for screen.
BTW, I share your love for screen! I was quite interested in this option (it is new to me), although the SUID part is a bit of a drawback.
Keith
Doesn’t work for me. All I get is “Must run suid root for multiuser support.”, even though screen’s perms are -rwsr-sr-x.