Package Users - Short version

Last update: 31 december 2021. documents an interesting way of managing packages. Quotation from the file:


The idea is to create one pair user:group per package to be installed: a package user. Every package user is part of a secondary "install" group in order to be able to write in directories that are usually owned by the root user. In order to avoid that one package replaces a file or a directory installed by another one, the directories owned by the install group have the sticky attribute for users and groups other than the root user and the install group. For more details, read

The author of this hint also created some scripts really useful if one wishes to use package users on her computer. You can download the archive on

After you have booted GLLFSC and logged in as root, you can use this package management system by doing the following:

tar xf more_control_helpers.tar.bz2
cd more_control_helpers
rm sbin/{groupadd,useradd}
mkdir -v /etc/pkgusr
cp -Rv etc/* /etc/pkgusr
mkdir -v /usr/lib/pkgusr
cp -Rv lib/* /usr/lib/pkgusr
cp -v bin/* /usr/bin
cp -v sbin/{add_package_user,install_package} /usr/sbin
chown 0:10000 $(cat installdirs.lst)
chown 0:10000 \
    /share/doc \
    /share/gtk-doc/html \
    /share/bash-completion/completions \
    /include/sys \
    /local/lib/perl5/site_perl/5.18.1 \
chmod g+w,o+t $(cat installdirs.lst) \
    /share/man \
    /share/info \
    /share \
    /share/aclocal \
    /etc \
    /var/lib \
    /local/bin \
    /local/lib \
    /local/include \
    /local/share \
    /local/share/* \
    /local/share/man/man* \
    /share/doc \
    /share/gtk-doc/html \
    /share/bash-completion/completions \
    /include/sys \
    /local/lib/perl5/site_perl/5.18.1 \
sed -i.orig '/CREATE_MAIL_SPOOL/s/yes/no/' /etc/default/useradd

Installing a package


install_package foo


You have to get the source file of the program foo and install it as the user foo. Most of the time, the steps are simple:

su foo
tar xf foo-version.tar.gz
cd foo-version
./configure --prefix=
make install
cd ..
rm -rf foo-version
rm foo-version.tar.gz
exit 0

Removing a package

To remove the files installed by a package:

find / -user foo | xargs rm

Then remove the package user:

userdel foo

Some automation

I changed the default behaviour of pkgusr in some ways. I removed build, build.conf and .project files under /etc/pkgusr/skel, then created a /etc/pkgusr/skel/ with the following content:

# Exit on error:
set -e

tar xf 
./configure --prefix=
make install
cd ..
rm -rf 

exit 0

Then, I replaced the original content of /etc/pkgusr/bash_profile with:

#export PATH=/usr/lib/pkgusr:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/texlive/2013/bin/mips64el-unknown-linux-gnu:/usr/local/bin
export PATH=/usr/lib/pkgusr:/bin:/local/bin

# Make prompt reflect that we are a package user.
export PROMPT_COMMAND='PS1="\[\e[35m\]\A-package \u:\W\[\e[00m\]> "'

# Go to the home directory whenever we su to a package user.

if [[ -f ]]
    then mv build-`whoami`.sh
    if [[ -f /src/recipes-1.6/`whoami`.sh ]]
        then cp /src/recipes-1.6/`whoami` build-`whoami`.sh

alias less='less -ic'
alias make='make -j4'

To automate this, you can use my recipe for pkgusr.

Finally, I created /root/.bash_profile with the following content:

# Tab-complete package users when using su, finger or pinky
complete -o default -o nospace -A user su finger pinky