-3

Basically, we have Dropbox running on a server to keep some files synced.

It works nicely, except when Dropbox has to write the files itself. It keeps writing them as root, and my webserver cannot serve these files later on.

The current fix is a manual chown -R apache:apache /var/www/html, but it's unnecesary and cumbersome, with the server users having to call me to fix it each time they get forbidden.

So, the question is, how do I make dropbox write files as user/group apache?

Software: CentOS 5.6, daemonized dropbox server, apache

Bart De Vos
  • 17,761
  • 6
  • 62
  • 81
Christian
  • 462
  • 5
  • 22

1 Answers1

6

Well, first off, using Dropbox as a deployment-platform is a bad idea. There are more suited tools to do this, I'm thinking about rsync and/or git...

Nevertheless, you probably installed DropBox with the root-user. Don't do this, install it as the apache-user. The deamon will run under the apache-user and will create files that apache has rights to read/write.

Open up the deamon-script, you will see it's just running dropbox.py. Edit this to run under apache and not under root.

But, and I can't stress this enough, you should be on the lookout for better alternatives.

Bart De Vos
  • 17,761
  • 6
  • 62
  • 81
  • 4
    +1 for both "Don't install it as `root`" and "Find something better" -- [rsync](http://everythinglinux.org/rsync/), [git](http://git-scm.com/), [puppet](http://puppetlabs.com/), [chef](http://www.opscode.com/chef/), [radmind](http://sourceforge.net/projects/radmind/), [etc…](http://en.wikipedia.org/wiki/Comparison_of_open_source_configuration_management_software) – voretaq7 Apr 25 '12 at 08:42
  • rsync and git (as well as what voretaq7 suggested) do not meet our basic demands, add significant maintenance costs or are bloated with features we don't need. Trust me, I know my needs. – Christian Apr 25 '12 at 08:56
  • 1
    Then, while we're at it, why not write a script to change the owner of all files in `/var/www/html` and put in `crontab` and run it every minute? – Bart De Vos Apr 25 '12 at 09:09
  • 2
    There is a better way to achieve what you need: Don't use DropBox on a server. Try Capistrano or Fabric if you need a deployment tool. – Kenny Rasschaert Apr 25 '12 at 09:16
  • 1
    Why not just do things the right way instead of trying to compound one bodge with another. And security should *always* be of great importance. Sheesh – Rob Moir Apr 25 '12 at 09:19
  • 4
    @ChristianSciberras Wow - you need to learn how to deal with people who are trying to help you. That's a pretty bad attitude you have there, bud. – Dan Apr 25 '12 at 09:20
  • 1
    @ChristianSciberras Sometimes the right answer is "You're doing it wrong". If you can't accept that, perhaps this isn't the site best suited for you. – Dan Apr 25 '12 at 09:22
  • 3
    @ChristianSciberras If it matches all your needs, then you wouldn't be posting this question, would you? – Dan Apr 25 '12 at 09:23
  • 3
    Just because something meets your needs does not mean you should use it. I could use a tank to drive to the shops but, as much as I'd like to, it's not the best idea, is it? "Best practices" and all that. – tombull89 Apr 25 '12 at 09:25
  • 2
    Let me put this in other terms: Dropbox doesn't really have anything fancy for setting file permissions and ownership, because it's meant for syncing pdf files and vacation pictures. Real deployment tools on the other hand... – Kenny Rasschaert Apr 25 '12 at 09:27
  • 2
    A tank, while it could be driven to the shops, is not the best tool suited to the job. Dropbox, likewise, may work, but is also not the best tool for the job. Point aside, there's better ways of doing what you want to do. – tombull89 Apr 25 '12 at 09:27
  • That's it. I'm not answering anymore, it's obvious this is getting into useless trolling. – Christian Apr 25 '12 at 09:28