Results 1 to 2 of 2
Hi. I'm a C/C++ programmer; work extensively on Windows Multimedia.
Got a programming question for Linux. We're writing a server that has to run on linux. This server, similarily as ...
- 08-12-2009 #1Just Joined!
- Join Date
- Aug 2009
- Posts
- 1
Thread vs Process + Security
Hi. I'm a C/C++ programmer; work extensively on Windows Multimedia.
Got a programming question for Linux. We're writing a server that has to run on linux. This server, similarily as Apache, has to listen to a port for incoming requests. Once a request comes, we would like it to delegate the action.
So, my question is, how to do it securely. From what I understand, Apache or sshd run as root and listen to incoming requests but the actual processing is forwarded to another process. In case of Apache, another httpd process (usually owned by users lik apache/www/nobody) does the work (providing access to a website).
Similarily in case of sshd; the root sshd listens but forwards the request to a another sshd owned by some user.
So, how does it work? How a root process creates another process under different user? How a root process (httpd) communicates the request to another httpd process (owned by nobody). Are the new processes created at the start time or at the request? Any info is greatly appreciated.
Kind Regards,
Yaerek
- 08-12-2009 #2
Apache is mainly being run as root because it needs access to the reserved port 80. All ports less than 1024 are reserved, the ports above can be opened by unprivileged users as well, provided they are not in use already.
For changing the user under whom an application runs, read chapter 29 the GNU runtime library.
The GNU C Library
Especially 29.6.Debian GNU/Linux -- You know you want it.


Reply With Quote