Monday, January 18, 2010

Changing the DHCP (or any other service) config file in Ubuntu 9.10

This applies to Ubuntu 9.10 Karmic Koala. I did not have this problem in 8.10 Ibex.
I keep my system config files such as for dhcpd (DHCP daemon) in a separate directory with all my system tweaks. I then set up a symbolic link from /etc/dhcpd3/dhcpd.conf --> my config.

But when I started the dhcpd server via /etc/init.d/dhcpd3-server restart
I kept getting the error message "Can't open /etc/dhcp3/dhcpd.conf: Permission denied"

Moving the config to /tmp also did not work, as tested using the -t flag, via
dhcpd3 -t -cf /tmp/dhcpd.conf

Finally, after some hunting, aka Googling, I found the problem was Apparmor, which restricts the files and directories that various services can use. So I added the following line to /etc/apparmor.d/usr.sbin.dhcpd3, where the dir should be the physical dir you get from cd -P in bash, namely remove all symlinks:

...
/dir/holding/my/dhcpd/config/** r
...

I then restarted apparmor via /etc/init.d/apparmor restart

And now I'm golden.

No comments: