SSH session hangs when trying to open a shell

6,812

Solution 1

I think you need to check the remote passwd database (by default /etc/passwd) and see what shell is there (you can then check it via running it directly like you already do with some commands). Other place to look for apart from shell dot files in your home directory is /etc/pam.d and then you should check your remote ~/.ssh directory as well especially if you're using keys to log in.

The terminal issue may mean that bash -i expects a terminal, which can be triggered by ssh -t (it's turned off by default when running a command directly).

Solution 2

Looks like you don't have /dev/pts mounted (on the server). Login by other means (physical console) and mount it with mount -tdevpts pts /dev/pts/ and then try again.

If you have no physical access to your server you can try from your client: ssh [email protected] 'mount -tdevpts pts /dev/pts/' (not tested)

Share:
6,812

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    Since this morning I cannot login normally on my server using SSH anymore.

    Typically, when typing this:

    ssh [email protected]
    

    The shell hangs and does not acquire shell. The last line of verbose with -vv gives me:

    debug2: shell request accepted on channel 0
    

    That said, if I launch a command directly in SSH, such as:

    ssh [email protected] 'ls ~'
    

    ...it seems to work properly and it gives me the expected output. Actually, I can get a shell by forcing bash to launch in interactive mode, by typing:

    ssh [email protected] 'bash -i'
    

    I also tried to disable my .bashrc file (by moving it to .bashrc_OLD), but it didn't seem to be of any help.

    Any suggestion would be much appreciated, thanks!

    Edit: I've also tried to login with sh, but it didn't work neither. Thus I believe this is not related to a profile file issue.

    Edit 2: when I manage to get a shell using the -i flag, here is the additionnal message I get from the console:

    bash: cannot set terminal process group (-1): Invalid argument
    bash: no job control in this shell
    
  • Admin
    Admin over 10 years
    It didn't work, I'm afraid. Please also note that this is not just a lag, as it hangs indefinitely after "shell request...".