AmbroseChapel AmbroseChapel - 4 months ago 25
Bash Question

SSH to debian server instantly logs out

I'm trying to help someone with their Debian server.

They have Plesk. I made myself an user with Plesk and enabled SSH access.

I can log on ... but only for one second. I see the MOTD, I see a Debian disclaimer, then I'm logged out again. "Connection closed".

The only thing I could think to try is to change the shell settings, Plesk has a dropdown list of bash, csh, tcsh and so on next to the "allow ssh using:" option. But none of them works.

Any ideas gratefully received.

Answer

Plesk can get a bit quirky sometimes...

That behavior is similar to the one you get when a user account has a 'nologin' shell selected on the Plesk config. I would do some things:

  • Connect using ssh with the verbose option activated (ssh -v user@host) so you can get more detail.

  • Check the /etc/passwd file, look for your user and check that, the final field on that line, is pointing to a valid shell (something like /bin/bash instead of /bin/nologin or /bin/false).

  • Check also in that line that the home directory for that user ( that's configured on the field before of the shell ), is valid, exists, and has proper permissions and owner

  • Finally, check your logs (in /var/log; I think I would check syslog, messages and user), so maybe you can get any meaningful message.