Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm running Ubuntu desktop and I don't have permission to modify some local files on my computer. IE - within /var/www/ I can't create a new folder unless I sudo. How do I fix it so by default I have permission without logging in as the root user?

share|improve this question
    
The answers below are all technically correct, but don't address best practices. The real answer is that you shouldn't be modifying files in /var/www, you should instead be creating a new site within Apache and pointing the site root to some files which you can access - possibly within your home directory. –  kaerast Mar 25 '10 at 16:39

2 Answers 2

up vote 6 down vote accepted

Add a group (groupadd group), and then add yourself and the apache user to that group (usermod -a -G yourname group), then chown those files and directories to the group (chown user:group files). Make sure the permissions allow group to rwx (e.g. chmod 775, instead of chmod 755)

Now they're your files, and yet it won't break your web services.

share|improve this answer
2  
...with the addition that if you add yourself to the "www-data" group, you should already have permission to write to that directory. –  Aquarion Mar 25 '10 at 16:06
    
@Aquarion: Yep yep. –  Satanicpuppy Mar 25 '10 at 16:11
    
The chown isn't working for me. I've verified that I'm within the "developer" group, but when I run the command the way you wrote it it won't work. I want to make myself owner of /var/www/ and all of the files that are put there in the future. –  Webnet Mar 25 '10 at 16:24
    
you only need one colon in the command, and again - you shouldn't need to chown, just add yourself to the www-data group. –  kaerast Mar 25 '10 at 16:35
    
How should I configure a live server so we can still make remote modifications but in a secure way? –  Webnet Mar 25 '10 at 16:38

That behavior is by design in Unix-like systems. It helps prevent grave errors. Sudo is your friend.

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.