[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

test if user exists in postinst



Hi all
I am cleaning up my packages, and one improvement
I want to add is that network daemon runs under its
own UID, not nobody (as it was until now).

What is the best way of testing (and adding) a new username
in postinst?

I am using something like this:
if ! grep -q '^xtelld:' /etc/passwd; then 
    adduser --quiet --system --no-create-home --disabled-password --home /tmp --gecos "xtell daemon" xtelld
fi

the test for already existing user is not ideal, since 
users can be stored somewhere else (ldap, nis,...)

well, since adduser does work with passwd only and 
nis should be configured to consult system users from passwd
(I know nothing about ldap), I'll probably shut up
and leave it unchanged, unless someone has better idea...

-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



Reply to: