Project

General

Profile

[UE] lighttpd is not picking the server.username and server.groupname from the lighttpd.conf file

Added by bhanu.kvn over 3 years ago

Hi Team,

The lighttpd is not picking the updated server.username and server.groupname from lighttpd.conf file.

Below is my lighttpd.conf file content

ubuntu@ubuntu-j100:~$ cat /etc/lighttpd/lighttpd.conf

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
)

server.document-root        = "/var/www/html" 
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log" 
server.pid-file             = "/var/run/lighttpd.pid" 
server.username             = "bkvn" 
server.groupname            = "bkvn" 
server.port                 = 80

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/" 
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )
include_shell "/usr/share/lighttpd/create-mime.assign.pl" 
include_shell "/usr/share/lighttpd/include-conf-enabled.pl" 

User info in linux box

@ubuntu@ubuntu-j100:~$ cat /etc/passwd

root:x:0:0:root:/root:/bin/bash
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
bkvn:x:1001:1001::/home/bkvn:/bin/sh@

lighttpd script execution procedure

From the root user I am executing the conf file as shown below
/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf

Current Result

ps -aef | grep lighttpd
root 1292 1 0 07:08 ? 00:00:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd_webgui.conf
root 4360 4347 0 10:38 pts/0 00:00:00 grep lighttpd

Unable to understand why the process is running as root instead of mentioned user in the conf file.

Expected Result

I expected the lighttpd process should executed with user "bkvn" (as per lighttpd.conf file) and the process has started with "root" user.

Do any one know what could be the reason for the above issue?


Replies (3)

RE: lighttpd is not picking the server.username and server.groupname from the lighttpd.conf file - Added by gstrauss over 3 years ago

Do any one know what could be the reason for the above issue?

Operator error. -t in your command means test the config and exit, so something else is running that lighttpd instance.
lighttpd -h and read what the flags mean.

RE: lighttpd is not picking the server.username and server.groupname from the lighttpd.conf file - Added by bhanu.kvn over 3 years ago

gstrauss wrote in RE: lighttpd is not picking the server.username and serve...:

Do any one know what could be the reason for the above issue?

Operator error. -t in your command means test the config and exit, so something else is running that lighttpd instance.
lighttpd -h and read what the flags mean.

Thanks gstrauss for sharing the comments.

I tried by passing "-t" to the script execution as below. It shown the syntax is correct

lighttpd -t -f /run/lighttpd_webgui.conf
Syntax OK

And I tried by setting invalid server.username and server.groupname in the lighttpd.conf file which was not defined in /etc/passwd file, and then ran the configuration file
ighttpd -f /run/lighttpd_webgui.conf

Observed Result

ps -aef | grep lighttpd
root 1312 1 0 11:51 ? 00:00:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
root 3256 4347 0 14:01 pts/0 00:00:00 grep lighttpd

Expected Result

Should throw an error message defined in server.c of lighttpd
can't find username or
can't find groupname

Note:
My linux box has access to the getuid() and also having pwd.h (HAVE_PWD_H)

RE: [UE] lighttpd is not picking the server.username and server.groupname from the lighttpd.conf file - Added by gstrauss over 3 years ago

I wrote:

lighttpd -h and read what the flags mean.

Did you read that carefully and use -tt? Did you check $? after running that command?
Use -D to test while keeping lighttpd in the foreground?

Try the commands on How to get support

You might also strace your execution of lighttpd to see if anything goes wrong.

    (1-3/3)