3

I have a server, where I can login using SSH, but do not get a shell (anymore). What can I do to login to a minimal shell to debug the issue? Here is the log of ssh -vvvv

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering ED25519 public key: user@myhost
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /home/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
Authenticated to remotehost ([x.x.x.x]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network

Normally a session would continue with

debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start

But here ssh just hangs.

How can I get a login shell? I tried ssh -t user@host /bin/sh but it did not work.

I am not sure if something in the ssh server is wrong (maybe waiting for rDNS resolution while there are network errors?) or if some login shell script is blocking the shell.

allo
  • 1,524
  • 1
  • 19
  • 35
  • What do the logs on the server say? – Jenny D Dec 26 '17 at 15:26
  • Any change the user is not allowed to use `/bin/sh/` or `/usr/bin/sh`? I.E `user` is a proxy user (with no login shell) rather than standard user. – Praveen Premaratne Dec 26 '17 at 15:30
  • I do not know what the logs on the server say, as I cannot login to the server. It looks fine in munin, but ssh hangs. The user is just the user I usually use to login. Logging in as root (which is allowed in the server config) has the same problem. Every hanging login attempt adds 1 to the load of the server. – allo Dec 26 '17 at 15:34
  • Which distribution are you using? Is it Debian? – Ortomala Lokni Feb 09 '18 at 17:33
  • What happens if you try to ssh as a different user? – kasperd Feb 11 '18 at 16:12
  • 2
    If every login attempt adds 1 to the load on the server, maybe there's something wrong with the disk subsystem that holds the shells. Is /home on a different drive? – toppledwagon Feb 11 '18 at 20:58
  • Have you tried `scp` or `sftp`? I think one of them is potentially implemented internally within ssh, which could allow you to get the logs even if the rest of the things don't work. – cnst Feb 12 '18 at 05:06
  • Your symptom seems similar with the one discussed here: https://serverfault.com/questions/792486/ssh-connection-takes-forever-to-initiate-stuck-at-pledge-network. Are you able to restart the systemd-logind? – Chun Liu Feb 12 '18 at 07:10
  • @Morpheus, seriously, systemd just randomly decides to make SSH stop working if an unrelated service gets restarted?! How do they justify such behaviour, I wonder? A slow year for RedHat?! – cnst Feb 13 '18 at 01:22
  • See [this question](https://askubuntu.com/questions/93692/no-prompt-after-successful-ssh-login) for a few hints. – trueCamelType Feb 15 '18 at 05:29
  • The reasonable way forward is to use whatever tool you have to get console access and start looking at the logs. If you don't have console access, contact someone who does. As a last resort you could try rebooting the thing, but there's no guarantee whatsoever that it'll come back online in any usable form. – Jenny D Feb 15 '18 at 10:41
  • 1
    I "solved" it some time ago by rebooting. The link from @trueCamelType is interesting, as https://askubuntu.com/a/440238 could be the solution. The system was some SoC without a RTC, which could have a wrong time when I tried logging in. – allo Feb 15 '18 at 11:40
  • @kubanczyk, Ubuntu didn't invent systemd, so, my comment stands. – cnst Feb 15 '18 at 20:53
  • Have you checked the existence of the file /etc/nologin and TCP wrappers configuration (files /etc/hosts.allow and /etc/hosts.deny)? – José Castillo Lema May 02 '18 at 19:22

0 Answers0