What is the default password of screen?

24,129

Solution 1

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.

Solution 2

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.

Solution 3

the password of the user that owns the screen process.

Solution 4

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.

Share:
24,129

Related videos on Youtube

slhck
Author by

slhck

Updated on September 18, 2022

Comments

  • slhck
    slhck almost 2 years

    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

    • sehe
      sehe over 12 years
      I expect it depends on whether screen is in a login shell, and whether login is enabled for screen
  • Cleber Goncalves
    Cleber Goncalves over 10 years
    What 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...
  • Sirex
    Sirex over 10 years
    using 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
  • tripleee
    tripleee over 8 years
    For how to configure a custom lock program, see also serverfault.com/a/639406
  • Cerin
    Cerin over 8 years
    And what if the user has no password and you use an SSH key to login?
  • jpjacobs
    jpjacobs over 8 years
    I think then the user should not lock his screen; he might not be able to login again afterwards...
  • deltab
    deltab over 8 years
    @jpjacobs: Alas, It's not always the user's choice: superuser.com/questions/344301/…
  • valid
    valid almost 8 years
    @Cerin: Open a new SSH connection and steal the screen session from yourself.
  • aaiezza
    aaiezza almost 7 years
    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?
  • jozxyqk
    jozxyqk almost 3 years
    I tried adding this to my ~/.screenrc but it didn't seem to work. If there is an error in your .screenrc file, it appears that screen ignores the file silently. zodiac's answer worked though.