Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been doing my google-fu, but I can only find outdated guides or guides pertaining solely to the server variations of Ubuntu.

I need to set it up so that ssh server is run on boot, so I can access the computer remotely without having to first physically log in on the host computer. How would I do that? I already have ssh server set up so that I can log in and all that, but first I would have to log in on the host and run sudo /etc/init.d/ssh start

share|improve this question
Are you on wireless? – Leon Nardella Sep 9 '10 at 13:17
I am on wireless, yes. – Tommy Brunn Sep 9 '10 at 13:33
I think you should right click on the connection icon, select Edit Connections, click on the Wireless tab, double-click your wireless connection and mark both "Connect automatically" and "available to all users". That means your connection will be up and running without logging in graphically. – Leon Nardella Sep 9 '10 at 13:56
How would you need the SSH to work? If you simply want the connection active in the background, it's quite easy, but if you want the SSH shell to appear whenever you login, it's a different solution. – Oxwivi Jun 18 '11 at 9:27

This should do the trick..

sudo update-rc.d ssh defaults

EDIT: If your network is configured with Network Manager then the connection will not be established until a user logs in through the GUI. For manually configuring you have to edit the /etc/network/interfaces file, have a look at this guide and if you use wireless you can have a look here

share|improve this answer
I am on a wireless network. That question you linked to last suggested that all I would need to do was to enable the connection for all users. Is that the case? – Tommy Brunn Sep 9 '10 at 13:36
I linked incorrectly, the link is now fixed and additional you can look at this: – LassePoulsen Sep 9 '10 at 14:24
What is it about this command sudo update-rc.d ssh defaults that should resolve the problem? In other words, what does this command do? – HairOfTheDog Jul 11 '14 at 16:52
@HairOfTheDog it sets the ssh server to start at default runlevels... – LassePoulsen Jul 12 '14 at 17:02
This command has made starting ssh not possible.. maybe next time specify exactly what a command does that way for future onlookers we can tell whether or not they will work with the current version or possibly break something such as this. – Aaron Flores Apr 13 '15 at 14:37

Did you install it with something like apt-get install openssh-server? Because that package always starts ssh by default. If it's not starting by default you probably did something wrong. :-P

share|improve this answer
That's unfair - a package maintainer may have changed the default behaviour, so as it only runs on login, or other services it relies on (such as networking) may not run until a user logs in. – Logos Jul 8 '13 at 10:58
If the machine you're trying to contact is getting its ip address via DHCP then you might want to check if the address has changed after a reboot. – Stefan Schmidt Aug 15 '13 at 11:45
This comment is extremely unhelpful. So something is wrong. What do I do now? – JFA Mar 18 '15 at 19:58

In order to get a connection at startup with wireless using WPA (WEP is not a problem to set in /etc/network/interfaces), I used to use cnetworkmanager and start it in rc.local. cnetworkmanager will let you use NetworkManager without having to log in to a desktop.

share|improve this answer

This will work on sysV systems, but the newest ubuntu uses systemd to control the boot process. In order to get sshd to start on boot for a systemd system, you need to

systemctl enable ssh.socket

as root.

share|improve this answer
this solve my problem.. that after boot service need a restart to ssh service to make it active. – onalbi Jul 19 at 12:36

If you install the openssh server from the repository it should start on boot by default, regardless of having a network connection available or not (which is a different issue for which mot people is responding).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.