Running DNF as an unprivileged user

I’d like to run DNF as an unprivileged user.
Using custom repo, installing into a chroot that unprivileged user has full control of.
Is that possible?

dnf --releasever=38 --nogpgcheck --installroot=/tmp/REPRODUCER/CHROOT install xxxxx
Error: This command has to be run with superuser privileges (under the root user on most systems).

It would come handy to me in creating reproducers requiring custom repofile and destination, without polluting the system or running as root.

I can run it as root. As well as add the user to sudoers file.

The idea is that IMO technically there’s no need for extra privileges at all, when installing to chroot under my control.

I think it expects to run RPM scripts as root and this is problematic to work around.
You can configure sudoers to allow DNF to run with elevated privileges, or utilize some container-based virtualization.

1 Like