Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

The way I fixed this problem is, unfortunately, to manually change the last parameter in /etc/passwd for users I want to give shell access. It is /bin/bash instead of /bin/false.

When a user logs on, the shell takes them to their user directory and possibly runs a "startup" script.

  1. Is the user directory on the local machine? Does it have to be mounted from a fileshare (this has happened to me on more than one occasion)? If that fileshare is not mounted you will get disconnected.
  2. Take a look at the startup scripts for those shells. Bash uses various startup scripts depending on the circumstance, these include /etc/profile and ~/.bashrc. These scripts sometimes do wacky things that may disconnect you for any number of reasons.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top