From 6fbf61aae8b4e7a8a5d837817e40e592ea025c0f Mon Sep 17 00:00:00 2001 From: kneutron <50146127+kneutron@users.noreply.github.com> Date: Tue, 13 Apr 2021 12:12:10 -0500 Subject: [PATCH] if root run on port 80 --- simplewebserver.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/simplewebserver.sh b/simplewebserver.sh index 89c3e0f..9cc4de0 100644 --- a/simplewebserver.sh +++ b/simplewebserver.sh @@ -6,5 +6,13 @@ # REF: https://www.perlmonks.org/?node_id=865148 # REF: https://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html#:~:text=Priviliged%20ports,has%20put%20up%20for%20you. -python -m SimpleHTTPServer 80 > ~/simple-web-server.log 2>&1 +runport=8080 + +##Check for root priviliges +if [ "$(id -u)" -ne 0 ]; then + runport=80 +fi + +echo "$0 running on port $runport" +python -m SimpleHTTPServer $runport > ~/simple-web-server.log 2>&1 date