2

I just installed Debian 6, after reboot sshd stopped responding. I put the default config file but it not help. In the logs (/var/log/auth,syslog) no errors. I think the problem is that sshd not start. How can I try to run it? maybe do something in the startup scripts? Unfortunately I do not have physical access to my virtual machine, and can only reload it and view/edit the files in the filesystem.

[ added ]

Oh, thanks all. I found the problem.

Added /usr/sbin/sshd -e 2>/tmp/sshd_error to crontab

And get: /bin/sh: /usr/sbin/sshd: No such file or directory

Vaguely I could not understand where to lost a binary file on a freshly installed machine and I could work without it.

But now another question: how can I restore it?

vlad
  • 129
  • 1
  • 6

4 Answers4

1

You can run sshd in debug mode using the -d switch. This causes sshd to stay in the foreground and print messages to the console. You can increase the volume of log messages by adding more -d's

/usr/sbin/sshd -d

for normal logging

/usr/sbin/sshd -ddd 

for lots of logging.

user9517
  • 115,471
  • 20
  • 215
  • 297
  • Unfortunately I have no shell access to the server. Can only reload server and view/edit the files. – vlad Jun 12 '11 at 19:20
1

Set the log level to DEBUG in sshd configuration.

LogLevel DEBUG
user9517
  • 115,471
  • 20
  • 215
  • 297
bbaja42
  • 161
  • 2
  • 11
0

You can start sshd by hand with exec /usr/sbin/sshd -D to see if sshd works in general. If it does, a update-rc.d ssh defaults should create the init.d symlinks as required.

tohuwawohu
  • 158
  • 1
  • 1
  • 9
  • I have no shell access to the server. Can only reload server and view/edit the files. Maybe I can write something in the startup scripts? – vlad Jun 12 '11 at 19:21
  • no shell access? oh oh... does the `/etc/init.d/ssh` script exist? If it does (and if it contains the `exec /usr/sbin/sshd` call), take a look into the `/etc/rc[0-6].d` directories if there's a symlink. if there's no symlink, you could try to copy the script into /etc/rc3.d/, rename it to `S16ssh` (for example) and see if it's executed after a reboot. – tohuwawohu Jun 12 '11 at 19:42
  • @vlad: IMHO the best solution would be to **re-install debian from scratch**. If `sshd` is missing completely, most likely its dependencies are missing, too. Maybe other vital components are also missing, so i think it doesn't make much sense trying to repair that system manually. – tohuwawohu Jun 13 '11 at 07:49
  • Thanks. It turned out that it was a problem hosting company, they use a common packages (like sshd and etc) for all virtual machines and they have something broken. – vlad Jun 13 '11 at 12:35
0

Maybe ssh isn't activated at boot? See if there are pointers in /etc/rc.d to /etc/init.d/ssh. Alternatively, it may not start if the ssh main key is missing. Check if /etc/ssh/ssh_host*key are present.

wazoox
  • 6,918
  • 4
  • 31
  • 63