mirror of https://github.com/XTLS/Xray-install
use DynamicUser instead of nobody
parent
242123f0b0
commit
b8f249d384
|
@ -518,6 +518,12 @@ install_startup_service_file() {
|
||||||
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
|
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
|
||||||
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
|
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
|
||||||
fi
|
fi
|
||||||
|
local temp_UserSet=""
|
||||||
|
if [[ "$INSTALL_USER" -eq 'nobody' ]]; then
|
||||||
|
temp_UserSet="DynamicUser=yes"
|
||||||
|
else
|
||||||
|
temp_UserSet="User=${INSTALL_USER}"
|
||||||
|
fi
|
||||||
cat > /etc/systemd/system/xray.service << EOF
|
cat > /etc/systemd/system/xray.service << EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Xray Service
|
Description=Xray Service
|
||||||
|
@ -525,7 +531,7 @@ Documentation=https://github.com/xtls
|
||||||
After=network.target nss-lookup.target
|
After=network.target nss-lookup.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=$INSTALL_USER
|
${temp_UserSet}
|
||||||
${temp_CapabilityBoundingSet}
|
${temp_CapabilityBoundingSet}
|
||||||
${temp_AmbientCapabilities}
|
${temp_AmbientCapabilities}
|
||||||
${temp_NoNewPrivileges}
|
${temp_NoNewPrivileges}
|
||||||
|
@ -545,7 +551,7 @@ Documentation=https://github.com/xtls
|
||||||
After=network.target nss-lookup.target
|
After=network.target nss-lookup.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=$INSTALL_USER
|
${temp_UserSet}
|
||||||
${temp_CapabilityBoundingSet}
|
${temp_CapabilityBoundingSet}
|
||||||
${temp_AmbientCapabilities}
|
${temp_AmbientCapabilities}
|
||||||
${temp_NoNewPrivileges}
|
${temp_NoNewPrivileges}
|
||||||
|
|
Loading…
Reference in New Issue