I've setup a local repo with reprepro, accessible via a local web server. Thus every file and dir in its file sub-tree owns to www-data:www-data. The problem is that every time I add a new package I need to use sudo, that makes all the permissions of the files involved to change, and every time I have to fix this by hand.

Any clue how can I avoid this? Maybe using a sticky bit?

Thanks in advance.

  • I'm unclear why sudo is changing your file permissions. Can you provide an example? In any case, acl is often an option if you want to "force" permissions. See for example unix.stackexchange.com/a/115632/4671. If you give more details, I may be able to offer a more detailed response. Sep 9, 2017 at 12:00
  • Because acting as root changes the permission from www-data to root with its umask, and it brokes the whole mechanism.
    – Daniele
    Sep 9, 2017 at 13:30

1 Answer 1


You can tell sudo you want to run commands as www-data instead of root:

sudo -u www-data ...

That way the ownership of your repository won’t change.

  • It works, I tried before with: su www-data -c 'reprepro etc... but it returned this error: This account is currently not available
    – Daniele
    Sep 9, 2017 at 13:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .