...you must arrange for your package to create the user or group if necessary using adduser in the preinst or postinst script (again, the latter is to be preferred if it is possible).
I wanted to stick to the postinst since it's preferrable so I couldn't change the permissions in the rules file.
Now the thing is I need to give this user permissions for the dirs it will need to own/write and so on. I already have the dirs listed in debian/dirs and I don't want to hardcode anything else in the rules or in the postinst. Of course not being a so experienced debian devel I started to google but didn't find anything... asked around but nothing yet... so I hacked it in this way in the end:
MYDIRS := $(shell cat $(CURDIR)/debian/dirs)
SUBME := $(foreach dir, $(MYDIRS), chown -R \$$the_user $(dir);)
SUBFRIENDLY := $(shell echo "$(SUBME)" | sed -e 's/\//\\\//g')
binary-indep: build install
sed -i -e 's/PLACEHOLDER/$(SUBFRIENDLY)/' $(DESTDIR)/DEBIAN/postinst
#Creating the user if it does not exist
if ! getent passwd $the_user > /dev/null; then
#Changing the permissions for the given dirs
(user=xyz can be easily changed to numeric ID)
I don't know if this is the 'standard' way to do it (nor if there is a standard way) but it's at least a way that worked... If anybody there can give me an hint on how to do it better, it would be really appreciated.