diff --git a/alpinelinux/install-release.sh b/alpinelinux/install-release.sh index a7f14f4..bef0a03 100644 --- a/alpinelinux/install-release.sh +++ b/alpinelinux/install-release.sh @@ -12,7 +12,6 @@ check_alpine() { } check_if_running_as_root() { - # If you want to run as another user, please modify $EUID to be owned by this user if [ "$(id -u)" -eq 0 ]; then return 0 else @@ -154,10 +153,15 @@ install_confdir() { install_log() { LOG='0' if [ ! -d '/var/log/xray/' ]; then - install -d -o nobody -g nobody /var/log/xray/ + install -d -m 755 -o 0 -g 0 /var/log/xray/ install -m 600 -o nobody -g nobody /dev/null /var/log/xray/access.log install -m 600 -o nobody -g nobody /dev/null /var/log/xray/error.log LOG='1' + else + chown 0:0 /var/log/xray/ + chmod 755 /var/log/xray/ + chown nobody:nobody /var/log/xray/*.log + chmod 600 /var/log/xray/*.log fi } diff --git a/install-release.sh b/install-release.sh index 785d6ac..739d12d 100755 --- a/install-release.sh +++ b/install-release.sh @@ -116,7 +116,6 @@ systemd_cat_config() { } check_if_running_as_root() { - # If you want to run as another user, please modify $EUID to be owned by this user if [[ "$(id -u)" -eq 0 ]]; then return 0 else @@ -511,12 +510,15 @@ install_xray() { # Used to store Xray log files if [[ "$NO_LOGFILES" -eq '0' ]]; then if [[ ! -d '/var/log/xray/' ]]; then - install -d -m 700 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /var/log/xray/ + install -d -m 755 -o 0 -g 0 /var/log/xray/ install -m 600 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /dev/null /var/log/xray/access.log install -m 600 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /dev/null /var/log/xray/error.log LOG='1' else - chown -R "$INSTALL_USER_UID:$INSTALL_USER_GID" /var/log/xray/ + chown 0:0 /var/log/xray/ + chmod 755 /var/log/xray/ + chown "$INSTALL_USER_UID:$INSTALL_USER_GID" /var/log/xray/*.log + chmod 600 /var/log/xray/*.log fi fi }