I am currently building my own aptitude repository, and in the process of ensuring that all packages pass as many Lintian checks as possible. Currently I am struggling with 'wrong-file-owner-uid-or-gid' (initial information here, more detailed information here), and am unsure what a suitable number to use for UID and GID is.

Currently I am building packages on an AWS Ubuntu machine:

$ id ubuntu
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),102(netdev)

These are all as default on the machine. The first link provided says:

The set of the allowed, globally allocated IDs consists of the ranges 0-99, 64000-64999 and 65534.

Of these ranges, the second link states:

0-99: Globally allocated by the Debian project, the same on every Debian system. These ids will appear in the passwd and group files of all Debian systems, new ids in this range being added automatically as the base-passwd package is updated.

Packages which need a single statically allocated uid or gid should use one of these; their maintainers should ask the base-passwd maintainer for ids.

60000-64999: Globally allocated by the Debian project, but only created on demand. The ids are allocated centrally and statically, but the actual accounts are only created on users' systems on demand.

These ids are for packages which are obscure or which require many statically-allocated ids. These packages should check for and create the accounts in /etc/passwd or /etc/group (using adduser if it has this facility) if necessary. Packages which are likely to require further allocations should have a "hole" left after them in the allocation, to give them room to grow.

65534: User nobody. The corresponding gid refers to the group nogroup.

Can somebody help explain how to conform to this Lintian check for Debian packages? Is it as straightforward as changing the user's UID and GID? What is the most appropriate ID number to choose?

  • How are you building the package? Are you using the binaries provided in the dpkg-dev package or the devscripts package? – saiarcot895 Jan 9 '16 at 16:54

Unless you have a particular need for another UID or GID, the most suitable values are 0 and 0, respectively. Packages are installed by root, or someone with root's powers. Typically the files they contain are expected to be owned by root, unless there's a specific reason for the files to owned by another user or group (configuration files, perhaps). My guess would be that your debian/rules is not running dh_fixperms:

dh_fixperms is a debhelper program that is responsible for setting the
permissions of files and directories in package build directories to a
sane state -- a state that complies with Debian policy.

dh_fixperms makes all files in usr/share/doc in the package build
directory (excluding files in the examples/ directory) be mode 644. It
also changes the permissions of all man pages to mode 644. It makes all
files be owned by root, and it removes group and other write permission
from all files.
  • Thanks! I was not aware of dh_fixperms for this issue. – Mike Roberts Jan 9 '16 at 21:32
  • @MikeRoberts Most new packagers don't have to be aware of dh_fixperms. If you have the boilerplate %: dh ... debhelper rule that's commonly seen in packaging guides, debhelper will call dh_fixperms at the right time. – muru Jan 9 '16 at 21:34
  • I think I was missing quite a bit of crucial information with regards to how to actually create a package (particularly regarding debhelper) - I had been writing scripts which analysed Lintian output in an attempt to resolve them. This answer helped me to find what you are referring to so that I can overhaul and simplify the process! – Mike Roberts Jan 10 '16 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.