Find pkg added users/groups

Matthew Seaman matthew at FreeBSD.org
Thu Dec 1 19:46:54 UTC 2016


On 01/12/2016 17:17, Arthur Chance wrote:
> pkg info -l lets me see what files a package adds. Is there any easy way
> to see what users and groups (if any) a package adds?
> 

Something like this?

% pkg info -Rx trousers | grep -EA 6 'Creating (users|groups)'
echo "===> Creating groups."
if ! ${PW} groupshow _tss >/dev/null 2>&1; then
  echo "Creating group '_tss' with gid '601'."
  ${PW} groupadd _tss -g 601
else
  echo "Using existing group '_tss'."
fi
echo "===> Creating users"
if ! ${PW} usershow _tss >/dev/null 2>&1; then
  echo "Creating user '_tss' with uid '601'."
  ${PW} useradd _tss -u 601 -g 601 -L daemon -c "TrouSerS user" -d
/var/empty -s /usr/sbin/nologin
else
  echo "Using existing user '_tss'."
fi

(picking a random port that installs a new user and group)

I'm afraid there isn't a neat little report that will let you list this
information for all of your installed packages in some nicely formatted
way -- mostly that's because pkg(8) only sees a pre-install shell script
which is what creates the user/group, and not a list of userids to add.

	Cheers,

	Matthew


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-pkg/attachments/20161201/95f4e296/attachment.sig>


More information about the freebsd-pkg mailing list