Running apache as a non-root user
sudo
in file sudoers add following
username ALL=NOPASSWD:/usr/bin/service apache2 reload
Run on port 8080 and use iptables to redirect packets
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 8080
setuid wrapper program
httpdctrl.c
1 | #include <stdio.h> |
1 | gcc -o httpdctrl httpdctrl.c |
Run on docker, lxc, runC
docker pull apache
If you only need super-basic stuff on a non-priv port, you could run:
python -m SimpleHTTPServer 8000
Reference
http://stackoverflow.com/questions/525672/is-there-a-way-to-start-restart-stop-apache-server-on-linux-as-non-root-user
http://askubuntu.com/questions/694036/apache-as-non-root
http://serverfault.com/questions/69847/linux-how-to-give-a-user-permission-to-restart-apache
http://www.debian-administration.org/article/386/Running_network_services_as_a_non-root_user