[Dev] User ID allocation

Michal Witanowski m.witanowski at samsung.com
Thu May 22 09:16:06 GMT 2014


Hi,

Thanks for the reply.

We can't just do "useradd -r", because it will generate a "random" User ID.
We must be sure that UID of the deamon user will be the same, regardless
system configuration, existing users in the system, etc.

In the meantime I have found platform/upstream/setup repository
(https://review.tizen.org/gerrit/#/admin/projects/platform/upstream/setup,br
anches).
That would be ideal place to modify /etc/passwd file to reserve UID for our
purposes.
What do you think about it?

Best regards,
Michal Witanowski


-----Original Message-----
From: Dev [mailto:dev-bounces at lists.tizen.org] On Behalf Of Thiago Macieira
Sent: Wednesday, May 21, 2014 7:54 PM
To: dev at lists.tizen.org
Subject: Re: [Dev] User ID allocation

Em qua 21 maio 2014, às 17:35:32, Michal Witanowski escreveu:
> Hi all,
> 
> I was wondering if there exist any rules for User ID allocation on Tizen
3.0
> platform.
> 
> I'm in team working on Domain Separation (Linux Containers) and we need to
> reserve an UID for our daemon which will be communicating with containers
> via dbus socket (it  requires that UID in host and container match, so we
> can't trust default values).

Can't you simply have a useradd -r command in the RPM post-install rule?
This 
will create a UID for you. The software simply needs to getpwnam to get the 
UID.

Here's an install script example from openSUSE:

$ rpm -q --qf '%{PREIN}' NetworkManager-openconnect
getent group  nm-openconnect >/dev/null || groupadd -r nm-openconnect
getent passwd nm-openconnect >/dev/null || useradd  -r -g nm-openconnect \
                                                    -d
/var/lib/nm-openconnect 
\
                                                    -s /sbin/nologin \
                                                    -c "NetworkManager user 
for OpenConnect" \
                                                    nm-openconnect


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Dev mailing list
Dev at lists.tizen.org
https://lists.tizen.org/listinfo/dev



More information about the Dev mailing list