What is the default password of screen?

24

3

When I type Ctrl-X X (sic) in screen, the session is locked. What is the default password? Is it the same password which I use to log in to linux?

I ask because: I connect to several different remote linux servers via ssh, under various flavours of linux/unix, and have screen sessions running on all of them. When I lock the screen session and type my password, sometimes it works and on other installations it does not work and I therefore don't know what the password is (so I have to "quit" that screen session externally).

So, what is the default password of screen?

P.S.: I am never root. Version of screen used: Screen version 4.00.03 (FAU) 23-Oct-06

user50105

Posted 2011-10-07T09:34:00.323

Reputation:

I expect it depends on whether screen is in a login shell, and whether login is enabled for screen – sehe – 2011-10-07T09:45:29.857

Answers

13

The screen password has always been simply the system password of the user running it in my experience. the manpage says that if there's a screen lock program available, it will be used if configured so. So maybe you would need to figure out if this is the case, and how that program behaves.

jpjacobs

Posted 2011-10-07T09:34:00.323

Reputation: 296

For how to configure a custom lock program, see also http://serverfault.com/a/639406

– tripleee – 2016-01-22T07:27:47.850

13And what if the user has no password and you use an SSH key to login? – Cerin – 2016-01-27T00:40:47.003

1I think then the user should not lock his screen; he might not be able to login again afterwards... – jpjacobs – 2016-01-30T09:55:59.153

1

@jpjacobs: Alas, It's not always the user's choice: http://superuser.com/questions/344301/unexpected-behaviour-of-ctrl-a-x-and-ctrl-a-x-in-screen-regions-locking?rq=1

– deltab – 2016-02-05T14:28:34.933

6@Cerin: Open a new SSH connection and steal the screen session from yourself. – valid – 2016-08-21T10:05:02.167

So this is a good answer, however does anyone know what you might do in a slurm environment when logging into the compute nodes directly is not possible? – aaiezza – 2017-08-30T14:39:54.747

29

I sometimes find myself in the same situation, on servers where I have SSH public-key login and thus no password at all (that I know), and struggle to remember what I did last time to recover.

There is no need to kill the screen. Just disconnect the terminal you are running screen in, then open a new terminal window and reattach (screen -r).

Maybe as a precaution, add bind x to your .screenrc so that the lock keystroke is unbound. In an already running screen, use ctrl-A : bind x.

tripleee

Posted 2011-10-07T09:34:00.323

Reputation: 2 480

1Ah, simple but perfect - thanks! – Leonard Challis – 2015-07-09T11:53:09.233

2

the password of the user that owns the screen process.

Sirex

Posted 2011-10-07T09:34:00.323

Reputation: 10 321

2What do you do when there is no password? I use a passwordless SSH key to login to my server and screen still asks me for a password... – Cleber Goncalves – 2014-02-27T08:19:45.540

1using a phrase-less ssh key (bad idea btw, look into ssh-agent) isn't the same as having no password. screen will want whatever the users password is on the remote system in /etc/shadow – Sirex – 2014-02-27T17:37:19.277

0

After trying many approaches, I found that:

  • The BEST solution is adding two lines bind x bind ^x to your .screenrc file.

(Note If you are not root user, remember to add alias screen="screen -C [your .screenrc file path]" to your .bashrc file)

  • The second BEST solution is adding one line export LOCKPRG='/bin/true' to your .bashrc file. However, this method is somewhat uncommon, refer to this link

At last, thanks a lot to this guy disabling_gnu_screen_lock_screen, I just copy-paste his content here.

zodiac

Posted 2011-10-07T09:34:00.323

Reputation: 111