In command line, how can I stop all services from my Ubuntu (Server in this particular case), except SSH?
And how can I list all services to be sure all of them were stopped?
In command line, how can I stop all services from my Ubuntu (Server in this particular case), except SSH?
And how can I list all services to be sure all of them were stopped?
I seriously doubt that your system will be still in a useful state after disabling everything but sshd. For a status list of upstart services do:
For System V services:
Disable anything that has a + or is listed as start/running with the appropriate commands. To state the blatantly obvious: if you do this via ssh "service network stop" or the like won't do you any good.
What you are looking for is called single user mode. It is a state where only the bare essential services required for the machine to run are running. You enter it either by booting with an 's' argument given to the kernel, or you can switch to it using
init s
.sshd
is not normally considered an essential service though, so it would be stopped. To fix this, you need to edit /etc/init/ssh.conf and add an 'S' to the list of runlevels it should start in and not be stopped in, so it looks like this: