From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Setting new user:group with -daemonize?
Date: Tue, 15 Jul 2008 20:39:38 -0500 [thread overview]
Message-ID: <487D515A.90903@codemonkey.ws> (raw)
In-Reply-To: <487D2E27.1060809@quinthar.com>
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
>
>
next prev parent reply other threads:[~2008-07-16 1:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 23:09 [Qemu-devel] Setting new user:group with -daemonize? David Barrett
2008-07-16 1:39 ` Anthony Liguori [this message]
2008-07-16 2:14 ` David Barrett
2008-07-18 17:00 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=487D515A.90903@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).