So this is for a school assignment. I have a working Bind9 and Apache2 server.
I’ve written 3 scripts that make appropriate changes to the configuration files
- DNS add zone
- DNS add record
- HTTP add vhost
They are stored in
/etc/scripts
. These scripts are editable by root.
The user check needs them to run withsudo
so this should work.check@dennis:~$ bash /etc/scripts/dns_add_record
But I get Permission denied.
The permissions of the scripts are the following:
-rwsr-xr-x 1 root root 1875 Jan 3 03:31 dns_add_record.sh -rwxr-xr-x 1 root root 2103 Jan 3 03:53 dns_add_zone.sh -rwxr-xr-x 1 root root 1276 Jan 3 04:45 http_add_vhost.sh
I’ve added this rule to
/etc/sudoers
:check ALL=(ALL) NOPASSWD: /etc/scripts/dns_add_zone.sh
Am I looking over something?
Answer
You need to type sudo and then the command. So:
sudo bash pathtothescripts
Right now you are just executing them with the check user, not using sudo.
Attribution
Source : Link , Question Author : Dnice , Answer Author : StoutPanda