* [Qemu-devel] Setting new user:group with -daemonize?
@ 2008-07-15 23:09 David Barrett
2008-07-16 1:39 ` Anthony Liguori
0 siblings, 1 reply; 4+ messages in thread
From: David Barrett @ 2008-07-15 23:09 UTC (permalink / raw)
To: qemu-devel
Is there any way to make the qemu process change users after daemonizing?
Basically, I want to start it as root so I can have it "-redir" with a
low port (80), and then change to a non-root user after daemonizing. Is
there any way to do this currently?
Thankfully it opens the -redir port before forking, so it looks like a
straightforward change to vc.c: basically adding a call to "setuid()"
and "setgid()" after the call to "chdir()" on line 8711.
I'd update the -daemonize syntax as follows:
-daemonize [user[:group]]
Is there any interest in such a patch?
-david
PS: Why does it fork twice?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Setting new user:group with -daemonize?
2008-07-15 23:09 [Qemu-devel] Setting new user:group with -daemonize? David Barrett
@ 2008-07-16 1:39 ` Anthony Liguori
2008-07-16 2:14 ` David Barrett
0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2008-07-16 1:39 UTC (permalink / raw)
To: qemu-devel
David Barrett wrote:
> Is there any way to make the qemu process change users after daemonizing?
>
> Basically, I want to start it as root so I can have it "-redir" with a
> low port (80), and then change to a non-root user after daemonizing.
> Is there any way to do this currently?
>
> Thankfully it opens the -redir port before forking, so it looks like a
> straightforward change to vc.c: basically adding a call to "setuid()"
> and "setgid()" after the call to "chdir()" on line 8711.
>
> I'd update the -daemonize syntax as follows:
>
> -daemonize [user[:group]]
>
> Is there any interest in such a patch?
If you introduced two new options to specify the user and the group.
Also, I would be interested in a chroot option too :-)
> -david
>
> PS: Why does it fork twice?
It makes sure QEMU is an orphan process (it's parent is pid 1). It's a
pretty typical thing to do when daemonizing.
Regards,
Anthony Liguori
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Setting new user:group with -daemonize?
2008-07-16 1:39 ` Anthony Liguori
@ 2008-07-16 2:14 ` David Barrett
2008-07-18 17:00 ` Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: David Barrett @ 2008-07-16 2:14 UTC (permalink / raw)
To: qemu-devel
Anthony Liguori wrote:
> David Barrett wrote:
>>
>> I'd update the -daemonize syntax as follows:
>>
>> -daemonize [user[:group]]
>>
>> Is there any interest in such a patch?
>
> If you introduced two new options to specify the user and the group.
Ok, so you're saying you prefer two new options:
-user <user>
-group <group>
> Also, I would be interested in a chroot option too :-)
Adding the following also seems easy enough:
-chroot <path>
If I build it, any estimate of how long it'd take to make it into the
next mainline release?
>> PS: Why does it fork twice?
>
> It makes sure QEMU is an orphan process (it's parent is pid 1). It's a
> pretty typical thing to do when daemonizing.
Ah, very clever.
-david
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-07-18 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-15 23:09 [Qemu-devel] Setting new user:group with -daemonize? David Barrett
2008-07-16 1:39 ` Anthony Liguori
2008-07-16 2:14 ` David Barrett
2008-07-18 17:00 ` Ian Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).