# To run tvheadend, we need:
 #  - a startup script, and its config file
 #  - a default DB with a tvheadend admin
+#  - a non-root user to run as
 define TVHEADEND_INSTALL_DB
-       $(INSTALL) -D package/tvheadend/accesscontrol.1     \
-                     $(TARGET_DIR)/root/.hts/tvheadend/accesscontrol/1
+       $(INSTALL) -D -m 0600 package/tvheadend/accesscontrol.1     \
+                     $(TARGET_DIR)/home/tvheadend/.hts/tvheadend/accesscontrol/1
+       chmod -R go-rwx $(TARGET_DIR)/home/tvheadend
 endef
 TVHEADEND_POST_INSTALL_TARGET_HOOKS  = TVHEADEND_INSTALL_DB
 
        $(INSTALL) -D package/tvheadend/S99tvheadend          $(TARGET_DIR)/etc/init.d/S99tvheadend
 endef
 
+define TVHEADEND_USERS
+tvheadend -1 tvheadend -1 * /home/tvheadend - video TVHeadend daemon
+endef
+
 #----------------------------------------------------------------------------
 # tvheadend is not an autotools-based package, but it is possible to
 # call its ./configure script as if it were an autotools one.