1

I am connected to a computer over ssh. I have to reboot it remotely, while making sure that I will be able to reconnect to it over ssh just after reboot. I install 'bum' and marked sshd to be automatically started on boot. Is there a way to be completely sure that sshd will automatically start after reboot. Any help would be appreciated.

user34812
  • 111
  • 2

1 Answers1

2

There are some ways. You can create a cronjob which runs at reboot to start the SSH daemon. You can create a script which runs when the network comes up and starts the SSH daemon (via Network Manager's dispatcher facility, for example). You could add a command to /etc/rc.local to start the SSH service. You could write an Upstart job (and thus duplicate some work).

However, the fact is that the SSH service is autostarted by default. As long as the network comes up fine, you should be able to SSH into the system. If the SSH service failed for some reason, there's a good chance none of the aforementioned methods would have worked anyway.

muru
  • 197,895
  • 55
  • 485
  • 740
  • you're completely right! The good thing about having ssh started by a background script, is that if someone's so clever to shut down the service, it can automatically be restarted. BUT, as you've mentioned, there are always instances when SSHD cannot be started. For those situations, a remote access card is the only solution (e.g. Dell's DRAC or HP's ILO cards). There is no 100% guarantee that any service will come up properly, not ever. And yes, when you install the ssh-server package from the repository, it will automatically be started at boot (if all goes well). – Jakke Jun 21 '14 at 16:26