nut: Fix permissions with runas
Fix directory and conf file creation and owner/mode setting for when running as non-root. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
parent
e976846521
commit
77519cd204
1 changed files with 5 additions and 3 deletions
|
@ -109,7 +109,8 @@ nut_user_add() {
|
|||
}
|
||||
|
||||
build_server_config() {
|
||||
mkdir -m 0755 -p "$(dirname "$UPSD_C")"
|
||||
mkdir -p "$(dirname "$UPSD_C")"
|
||||
chmod 0640 "$UPS_C"
|
||||
rm -f "$USERS_C"
|
||||
rm -f "$UPSD_C"
|
||||
rm -f /var/etc/nut/nut.conf
|
||||
|
@ -229,7 +230,7 @@ build_global_driver_config() {
|
|||
build_config() {
|
||||
local STATEPATH=/var/run/nut
|
||||
|
||||
mkdir -m 0755 -p "$(dirname "$UPS_C")"
|
||||
mkdir -p "$(dirname "$UPS_C")"
|
||||
rm -f "$UPS_C"
|
||||
echo "# Config file automatically generated from UCI config" > "$UPS_C"
|
||||
chmod 0640 "$UPS_C"
|
||||
|
@ -256,7 +257,8 @@ start_driver_instance() {
|
|||
# If wanting a specific instance, only start it
|
||||
[ "$requested" != "$cfg" ] && [ x"$requested" != x ] && return 0
|
||||
|
||||
mkdir -m 0755 -p "$(dirname "$UPS_C")"
|
||||
mkdir -p "$(dirname "$UPS_C")"
|
||||
chmod 0755 "$UPS_C"
|
||||
|
||||
upsd_statepath
|
||||
build_config
|
||||
|
|
Loading…
Reference in a new issue