Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to mount the directory /var/www/mysite to the directory /home/daniel/mysite, but also have the user of the mounted files mapped from the original user (www-data) to my own user (daniel).

So that the file /var/www/mysite/index.php who's user is www-data will appear in the mounted directory as /home/daniel/mysite/index.php and be owned by daniel - and alternatively, if I create a file /home/daniel/mysite/test.php with my own user, it will be created in the original directory under the user www-data

Is it possible? If not, what alternatives do I have so I can use an IDE and still make sure all the files belong to the HTTP server's user?

share|improve this question
    
Why do you need the files to belong to www-data? –  grawity Aug 23 '11 at 11:18
    
I'm using a CMS (who shall remain nameless) that starts crying when files belong to other users –  daniel Aug 23 '11 at 15:44

2 Answers 2

The simplest solution would be to create a symbolic link using ln -s to the mysite folder under your home drive after granting yourself write access to everything under the mysite folder.

share|improve this answer
up vote 1 down vote accepted

I ended up using NFS to solve my conundrum. I used this tutorial as a base and ended up having the following in /etc/exports:

/var/www/mysite localhost(rw,sync,no_subtree_check,all_squash,anonuid=33,anongid=33)

(all in a single line; where 33 is www-data's UID and GID)

and the following in /etc/fstab:

localhost:/var/www/mysite /home/daniel/mysite nfs4 defaults 0 0

When I browse the directory it says every file belongs to www-data:www-data, but I can create and edit files as if they belonged to my own user.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.