How do I run HTTP server on port 80 using a non root user?


 
Thread Tools Search this Thread
Operating Systems Linux How do I run HTTP server on port 80 using a non root user?
# 8  
Old 08-25-2010
Quote:
Originally Posted by Luka
Unprivileged user (non-root) cannot run a process that is listening on port below 1024.
Sure it can. Unprivileged programs can't open ports below 1024, but they can sure use them once they have them. If apache had the programming for it, it could open the port as root, then switch to an unprivileged user and continue to use the network socket. There's a few pitfalls in this however -- your logfiles may end up owned by root and give you 'permission denied' when apache tries to log anything, etc. This and other reasons may be why apache doesn't.
# 9  
Old 08-25-2010
Quote:
Unprivileged programs can't open ports below 1024, but they can sure use them once they have them.
Therefore, you cannot run a process as an unprivileged user and make it listen on ports below 1024.

BTW, lighttpd drops the privileges after opening the socket. But, as Corona688 said, you have to set the right permissions to it's log files.
# 10  
Old 08-26-2010
I choose to give up finding solution to this problem.
Hope this issue be addressed at the kernel level in the future.
# 11  
Old 09-22-2010
That's not too likely given there's already user-level(if apache would just implement it) and firewall-level solutions.
# 12  
Old 09-22-2010
I'm not following you.

Apache starts as a priv user but all subsequent Apache processes have UIDs based on the conf file as mentioned by scottn here.

Apache works fine as is... so I am not sure what "if apache would just implement it" means....
# 13  
Old 09-23-2010
The best solution for you problem is using suPHP
Visit: _http://www.suphp.org/Home.html
# 14  
Old 11-12-2010
If your ask is how to allow a user to start/stop the webserver without having root / sudo access you can achieve this by having a C program perform the stop/start/restart. The C program would have to be root owned with a suid bit set. To mitigate risk of anyone stopping/starting the webserver you could perform a check within the program to ensure that the uid / guid executing the code is the only user / group authorized.

Mike
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

2. Shell Programming and Scripting

Script to run commands as root user

Hello I have a script which is working fine so far to generate HTML file. Now i am wondering how do i include a syntax where it can change itself to root user and execute a specific commands as root user. Please help, Thanks in advance. -Siddhesh (2 Replies)
Discussion started by: Siddheshk
2 Replies

3. Shell Programming and Scripting

Need to run a bash script that logs on as a non-root user and runs script as root

So I have a script that runs as a non-root user, lets say the username is 'xymon' . This script needs to log on to a remote system as a non-root user also and call up a bash script that runs another bash script as root. in short: user xymon on system A needs to run a file as root user and have... (2 Replies)
Discussion started by: damang111
2 Replies

4. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

5. AIX

Crontab cannot run by non-root user

Good morning everybody. I have just receiedv a complaint from our DBA saying that if he create a scripts to run some Oracle performance scripts using crontab and the scheduling part is ok but the job is failed when I checked on /var/adm/cron/log. I have tried his scripts using Oracle id directly... (4 Replies)
Discussion started by: kwliew999
4 Replies

6. Shell Programming and Scripting

run a script on logout by a non-root user

hi , i need to run a script that delete files when i logout as a user other than root user . I have tried out using .bash_logout but that doesnt seem to work , so any alternative for this to be done. Thanks in advance, Harsha (6 Replies)
Discussion started by: harsha10
6 Replies

7. UNIX and Linux Applications

How get root without local & with open port in server

hi all i have some question if any one can help me please How get root without local ? :( & How get root with open port in server use the telnet ? :( & How get root with Buffer Overflows ? :( please help me thanx to all (2 Replies)
Discussion started by: iis
2 Replies

8. Linux

Unblock port 80 for none root user

Hi all, I am running an oracle application server but the problem is that the default port it is using is 7777 and if i want to make it port 80 i have to run the server as root which something i do not want to do. If i understand well to run on a port under 1024 the application needs root... (1 Reply)
Discussion started by: staind_art
1 Replies

9. UNIX for Advanced & Expert Users

how to know how many user's connected to ftp and http server

i need to write a program to know how many users are presently connected to my ftp server and http server . i need to keep a count of this and this count should be available to other different software . how to make this GLOBAL so that other softwares can access this count value (7 Replies)
Discussion started by: hariprasad
7 Replies

10. Linux

VNC Server http listening port

Hi All, I'm running RH 9.0 on a PII box with 160MB RAM. Just downloaded RealVNC X86 Linux (version 3.3.7). How can I get the HTTP listening port up ? Thanks, KENT (6 Replies)
Discussion started by: kxchen_home
6 Replies
Login or Register to Ask a Question