Share the Knowledge!

Windows

You can use Dropbox as a free and automatic web publishing solution.  See this page.

Linux

You’ll want to review the Windows instructions above for the big picture, here are a few of the linux-specific instructions:

  1. Examples below assume root account, adjust your procedure accordingly!
  2. Create a new Dropbox account specifically for this server (this is “dropbox-project” in the Windows instructions above)
  3. Follow the installation instructions here using the account you just created.
  4. Link the html directory (or a subdirectory if desired) into the Dropbox as described here. Example:
ln -s /var/www/html /root/Dropbox/www/html

4.   From the Dropbox web interface of your new account, share the wwwhtml folder with your main account (“dropbox-bramus” above).  Sharing in this direction ensures the       server-side copy stays intact should you need to un-share/re-share for whatever reason.

Special steps for SELinux

When working under a default SELinux environment (such as CentOS 5.2) it is necessary to modify the security context of the ~/.dropbox folder. Until you do, files synchronized into /var/www/html/*/ will likely be labeled  :user_home_t,, preventing Apache from serving them. It appears that all files are downloaded into ~/.dropbox/cache before being copied into their final destination. With SELinux, security labels applied at file creation are maintained after relocation unless further steps are taken.

To enable Dropbox-Apache-SELinux coexistence:

semanage fcontext -a -t httpd_sys_content_t "/root/.dropbox(/.*)?"
restorecon -R -v /root/.dropbox

NOTE: It is important to use full absolute paths with the semanage tool to avoid problems when the filesystem is relabeled later.

This semanage command will add a persistent type context (httpd_sys_content_t) allowing Apache to serve files created created (initially!) within ~/.dropbox and its subdirectories. The restorecon will relabel the existing files with the new context. If you’ve already allowed Dropbox to synchronize files into your web server directories and you’re getting Permission Denied errors, you will need to update them as well:

chcon -R -v -t httpd_sys_content_t /var/www/html

For more information about how SELinux handles moving files, see section 5.1.1 at http://www.centos.org/docs/4/html/rhel-selg-en-4/rhlcommon-chapter-0017.html

Note: be sure to keep an eye on your bandwidth usage – public links for free accounts may not use more than 20GB of bandwidth per day while that limit is 200GB per day for paid Dropbox accounts.

Share the Knowledge!