From: Chris Koeritz Date: Mon, 13 Nov 2017 03:23:38 +0000 (-0500) Subject: keeping ownership to the real user behind sudo X-Git-Tag: 2.140.98^2~1^2~4 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=931c5e95f990bd8932e4a344993861965c5ae378;hp=6662bb3757f9a461d9caa064ebadb6ded5acf4a5;p=feisty_meow.git keeping ownership to the real user behind sudo --- diff --git a/scripts/system/add_apache_site.sh b/scripts/system/add_apache_site.sh index 30ff1f50..57b5d519 100644 --- a/scripts/system/add_apache_site.sh +++ b/scripts/system/add_apache_site.sh @@ -66,6 +66,9 @@ function write_apache_config() Include /etc/apache2/conf-library/rewrite-enabling.conf " >"$site_config" + + chown "$(logname):$(logname)" "$site_config" + test_or_die "setting ownership on: $site_config" } # turns on the config file we create above for apache. diff --git a/scripts/system/add_domain.sh b/scripts/system/add_domain.sh index e6b97fb6..80ebb2f3 100644 --- a/scripts/system/add_domain.sh +++ b/scripts/system/add_domain.sh @@ -63,6 +63,10 @@ function write_new_domain_file() ${domain_name}. IN A ${IP_ADDRESS} IN HINFO \"linux server\" \"${DISTRO}\" " >"$domain_file" + + # our personalized configuration approach wants the real owner to own the file. + chown "$(logname):$(logname)" $domain_file + test_or_die "setting ownership on: $domain_file" } # hooks up a new config file into bind's list of zones. @@ -86,6 +90,11 @@ zone \"${domain_name}\" in { //////////////////////////////////////////////////////////////////////////// " >> /etc/bind/named.conf.local + + # keep ownership for the real user. + chown "$(logname):$(logname)" /etc/bind/named.conf.local + test_or_die "setting ownership on: /etc/bind/named.conf.local" + } # adds a new subdomain under a containing domain. @@ -123,6 +132,9 @@ ${subdomain}.${containing_domain}. IN A ${IP_ADDRESS} IN HINFO \"linux server\" \"${DISTRO}\" " >> /etc/bind/${containing_domain}.conf + # keep ownership for real user. + chown "$(logname):$(logname)" "/etc/bind/${containing_domain}.conf" + test_or_die "setting ownership on: /etc/bind/${containing_domain}.conf" } function restart_bind()