From: Cam Hutchison <camh@xdna.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] packages: add ability for packages to create users
Date: Thu, 03 Jan 2013 02:35:16 -0000 [thread overview]
Message-ID: <606d.50e4ee64.b8dde@xionine.xdna.net> (raw)
In-Reply-To: 201301021931.54897.yann.morin.1998@free.fr
"Yann E. MORIN" <yann.morin.1998@free.fr> writes:
>Cam, All,
>On Wednesday 02 January 2013 Cam Hutchison wrote:
>> "Yann E. MORIN" <yann.morin.1998@free.fr> writes:
>>
>> >+* +LIBFOO_USERS+ lists the users to create for this package, if it installs
>> >+ a daemon you want to run with a specific user. The syntax is similar in
>>
>> "if it installs a program you want to run as a specific user"
>>
>> that is, s/daemon/program/ and s/with/as/
>Well, I would like to emphasise that this is primarily for running
>programs as daemons (ie. started by startup scripts). It does not
>really make sense to run program as a specific user when logged in,
>especially for embedded systems, where logging in a seldom done.
>What about:
>.... if it installs a daemon program you want to run as ...
I was considering a case of a periodic cron job running as a non-root
user - that is not a daemon, and is not related to logged-in users.
Since there are no actual constraints that require that the user added
be used only by a daemon, I figured the documentation should not introduce
that constraint. But documenting intentions is fine and I have no
strong feeling either way.
>> >+#----------------------------------------------------------------------------
>> >+get_uid() {
>> >+ local username="${1}"
>> >+
>> >+ grep -r -E "${username}:" "${PASSWD}" |cut -d: -f3
>>
>> An argument could be made that you should be using grep -F.
>I don't know (ie. I don't usualy use) this switch, so I am not confident in
>using it here. If plain 'grep' does the job, lets just use that.
The problem with plain grep is that if the username contains a regular
expression metachar, then grep will not work as expected in some cases.
The most likely one is a period - a username of foo.bar will match
an existing user of fooxbar and will not allow the creation of the user
foo.bar.
More strictly, it is a matter of handling user input correctly. The user
was not expecting a username to be a regular expression, so it should not
be treated as such ...
>> You should also anchor ${username}
>Yes, indeed.
.... but a start-of-line anchor will not work with grep -F :-(
Another +1 for awk here - processing record-oriented files is what awk is
good at, but I can understand not wanting to introduce that dependency.
next prev parent reply other threads:[~2013-01-03 2:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-01 20:10 [Buildroot] [pull request] Pull request for branch yem-package-create-user Yann E. MORIN
2013-01-01 20:10 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-01-01 21:50 ` Samuel Martin
2013-01-01 22:32 ` Yann E. MORIN
2013-01-03 21:46 ` Yann E. MORIN
2013-01-02 3:40 ` Cam Hutchison
2013-01-02 18:31 ` Yann E. MORIN
2013-01-03 2:35 ` Cam Hutchison [this message]
2013-01-03 10:31 ` Thomas Petazzoni
2013-01-03 17:35 ` Yann E. MORIN
2013-01-02 3:44 ` Cam Hutchison
2013-01-02 18:05 ` Yann E. MORIN
2013-01-01 20:10 ` [Buildroot] [PATCH 2/2] package/tvheadend: use a non-root user to run the daemon Yann E. MORIN
-- strict thread matches above, loose matches on Subject: below --
2013-01-03 21:47 [Buildroot] [pull request v3] Pull request for branch yem-package-create-user Yann E. MORIN
2013-01-03 21:47 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-01-13 22:50 [Buildroot] [pull request v4] Pull request for branch yem-package-create-user Yann E. MORIN
2013-01-13 22:50 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-02-05 14:54 [Buildroot] [pull request v5] Pull request for branch yem-package-create-user Yann E. MORIN
2013-02-05 14:54 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-02-06 0:12 ` Arnout Vandecappelle
2013-02-06 22:59 ` Yann E. MORIN
2013-02-06 23:20 ` Yann E. MORIN
2013-02-08 22:02 ` Yann E. MORIN
2013-02-12 6:27 ` Arnout Vandecappelle
2013-02-08 22:06 [Buildroot] [pull request v6] Pull request for branch yem-package-create-user Yann E. MORIN
2013-02-08 22:06 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-02-17 22:59 [Buildroot] [pull request v7 'next'] Pull request for branch yem-package-create-user Yann E. MORIN
2013-02-17 22:59 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-03-07 21:47 [Buildroot] [pull request v8] Pull request for branch yem-package-create-user Yann E. MORIN
2013-03-07 21:47 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
2013-03-08 17:09 ` Yann E. MORIN
2013-03-29 14:49 ` Jeremy Rosen
2013-04-12 17:14 [Buildroot] [pull request v9] Pull request for branch yem-package-create-user Yann E. MORIN
2013-04-12 17:14 ` [Buildroot] [PATCH 1/2] packages: add ability for packages to create users Yann E. MORIN
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=606d.50e4ee64.b8dde@xionine.xdna.net \
--to=camh@xdna.net \
--cc=buildroot@busybox.net \
/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