[Dev] User ID allocation

Thiago Macieira thiago.macieira at intel.com
Wed May 21 17:53:36 GMT 2014


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



More information about the Dev mailing list