1

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. – Faheem Mitha Sep 9 '17 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 '17 at 13:30
3

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 '17 at 13:32

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.