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

Possible Duplicate:
Chkconfig alternative for Ubuntu Server?

In Fedora I can do

$ chkconfig --list | grep ssh

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

sshd            0:off   1:off   2:off   3:off   4:off   5:off   6:off

and it shows all run levels. Then I can use

chkconfig sshd on


chkconfig sshd off

How can I do the same in my Ubuntu 11.04? + How do i mention in which runlevel it should start?

share|improve this question

marked as duplicate by Marco Ceppi Sep 9 '11 at 13:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 1 down vote accepted

Even if Ubuntu uses Upstart, not all services have been migrated to it yet and hence the old System-V style init scripts (files in /etc/init.d/.)

According to the manual page of chkconfig, off and on are used for stopping or starting services, not disabling them.

  • To start the SSH daemon (which is named ssh), run: sudo start ssh
  • Similarly, to stop it: sudo stop ssh

To list the status of all services, use: (N.B. output is lengthy and goes to stderr)

sudo service --status-all 2>&1 | more

These commands work for both the Upstart scripts as well as for the services in /etc/init.d/.

share|improve this answer
chkconfig we use for always to start when system starts. Is this same when we use "sudo start ssh" will it always start in any runlevel? – YumYumYum Sep 7 '11 at 16:36
How do i say which runlevel ssh should start? like chkconfig. – YumYumYum Sep 7 '11 at 16:37
For services using /etc/init.d/, you could use ls -1 /etc/rc?.d/*apache2. Upstart scripts can be checked with initctl show-config ssh, it would show. Note that Upstart still places wrapper scripts in /etc/init.d/ for compatibility reasons. – Lekensteyn Sep 7 '11 at 16:51

chkconfig is for sysv init system and Ubuntu uses upstart, to list all services and their status type initctl list. Currently there is no tool to enable or disable services in upstart so you have to manually rename the file in /etc/init so it doesn't end with .conf.

share|improve this answer
How do i say which runlevel? – YumYumYum Sep 7 '11 at 16:37
Runlevels are different on Debian and Ubuntu (vs. RPM distros). There really are only two effective runlevels. 1 and 2. Level one is the same as single-user mode on (most) any Linux. Runlevel 2 is what you would think of as 5 on Fedora. – Mark Russell Sep 7 '11 at 18:21

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