[aur-general] Prefered way to create users/groups and handle files ownership

Emil Lundberg lundberg.emil at gmail.com
Mon Jan 27 00:44:38 EST 2014


On Mon, Jan 27, 2014 at 5:35 AM, Jeremy Audet <ichimonji10 at gmail.com> wrote:
> As for a better solution? Hmm. `install` (and probably other tools too) can
> reference user and group names directly. Thus, this:
>
>> install -o141 -g141 -dm750 "${pkgdir}/var/log/inspircd"
>
> Could also be written as this:
>
>> install -o inspircd -g inspircd -dm750 "${pkgdir}/var/log/inspircd"

The problem with that is that the uid/gid for the permissions will be
computed on the machine where the package is built, and there is no
guarantee that the same uid/gid has the same name on another machine.
Of course this isn't a problem if the package is only in the AUR, but
it eliminates the option to prebuild the package (for inclusion in the
official repositories, for instance).

If you want an example, I've attached a simple bash script that
demonstrates the behaviour by referencing "uidgidtestuser1" when
building the package, then renaming that user to "uidgidtestuser2".
The script will output a PKGBUILD, build the package, run sudo and
manipulate users and install/uninstall the package, so MAKE SURE YOU
READ THE SCRIPT before you run it. I take no responsibility for any
damage caused by running it.

/Emil Lundberg


More information about the aur-general mailing list