Thursday, March 3, 2011

Password protect GNU screen sessions

SkyHi @ Thursday, March 03, 2011
Or, How do i get a crypted password for .screenrc ?
Here is a quick tip, hopefully it helps someone, I struggled with this for some time…
I have been using GNU screen program since a long time. This program is like a window manager for terminals and is especially useful for ISP and home shell accounts. You can have multiple shells running under the same session and can easily detach the sessions and reattach them from a different computer later etc.
I usually password protect my sessions by using the password command (ctrl A :password). But I had a hard time figuring out how to set that password in .screenrc file. The file obviously does not store it in plaintext and uses a crypted version of password. To get the crypted password, simply set your password in the screen session (ctrl A :password and then enter the password twice), then the crypted version gets automatically saved to screen’s copy buffer! All you need to do is have a line in your .screenrc which looks like this
password DTWxS2voQWkgI
After this all your new screen sessions will be automatically password protected (meaning you will need the password to reattach a session.)