etc/bind/rndc key: permission denied error When Restarting Bind


If you run into this error on a Ubuntu DNS Server, check your AppArmor configuration. To do so run the following command to pull up the AppArmor configuration.

sudo nano /etc/apparmor.d/usr.sbin.named

Make sure the following lines are showing and add them if they are not.

/etc/bind/ r,
/etc/bind/** r,

Now restart AppArmor with the following commands.

sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor start

Now restart Bind and the error should be gone.

sudo /etc/init.d/bind9 restart