Skip to content

Commit 41b79d0

Browse files
authored
Fix loss of the owner / group / permissions of the configuration file while overwriting it
With use "mv" command, configuration file owner, group and permission will become "root: root" with default permissions. This can lead to access problem, because a services will cannot access to the configuration file. For example, "named", will cannot restart, because required user "named" access to own configuration file. "Cat" command, will be overwrite config file too, but it saves owner / group / permissions original file.
1 parent 5500f3c commit 41b79d0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/v-change-sys-service-config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ if [ "$update" = 'yes' ] && [ "$restart" != 'no' ]; then
104104
service $service restart >/dev/null 2>&1
105105
if [ $? -ne 0 ]; then
106106
for config in $dst; do
107-
mv -f $config.vst.back $config
107+
cat $config.vst.back > $config
108+
rm -f $config.vst.back
108109
done
109110
check_result $E_RESTART "$service failed to start with new config"
110111
fi

0 commit comments

Comments
 (0)