I'm a rookie in Ubuntu and recently trying to learn Ubuntu. Now I encountered a very serious issue that for some reasons I need to update the configuration file like httpd.conf, hosts.deny and others and in order to make these changes to take effect, every time I rebooted the Ubutn server machine which is totally not allowed and produces serious impacts. I know Ubuntu has many kinds of configuation files, including ones from system itself, or user's applications, etc, so the questions I'm intending to ask are:

1, can anybody summarize a list of types of configuation files in Ubuntu?

2, what's the convenient way for making these changes to take effect without rebooting the machine?

Thanks in advance.

  • For changes maded on our own application's configuation file, I know how to take it effect, just restart the application. – Brady Zhu Aug 12 '13 at 2:48

It depends of the service, but in most cases involves sudo service <service name> reload:

sudo service apache2 reload
sudo service squid3 reload
sudo service sshd reload

In the case that the operation returns:

$ sudo service motd reload
Error: argument 'reload' not supported

You can try restart.

sudo service motd restart

If that don't work too, then a combination of stop and start:

sudo service motd stop
sudo service motd start
  • Thanks for the answer, sometimes, I just fix a bug and I don't know what the service the configuration file belongs to. In this case what do I do? – Brady Zhu Aug 12 '13 at 2:51
  • Well for many things manpages are useful. Try for example man deny.conf. This does not work for every file, but for nearly every service. Config-files to a service are most probably listed there. To search reverse (file->service) try something like google or duckduckgo.com to search for the file path and name to gather information. – verpfeilt Aug 12 '13 at 3:15

Some changes take effect immediately, because the /etc file is consulted each time it is needed. For example, if you update /etc/hosts (or in the example you give, /etc/hosts.deny), it is effective immediately because next time the contents are needed the file is re-read.

If you know the service related to the config file, then reload or restart the service - see Braiam's comprehensive answer.

If you don't know which service the file relates do, then perhaps you should not be editing it? :-)

One option is to look at the list of available services and take a guess. The service command invoked init.d scripts, so

$ ls /etc/init.d

will give you the list of services.

Another option is to find which package the config file belongs to. Ask dpkg:

# dpkg -S /etc/ntp.conf
ntp: /etc/ntp.conf

This tells me that /etc/ntp.conf belongs to the ntp package - and sure enough there is a ntp service that can be reloaded or restarted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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