Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

For some reason I can't change the file permissions of my var/www folder or anything else inside it. I've tried using gksu-nautilus to change the permissions but it doesn't work. When I open the properties window, and select a different level of permission for myself, it instantly switches back to the previous setting.

Any idea of how to fix this?

share|improve this question
1  
what happens if you changed file permission from the command line? –  Lie Ryan Jun 6 '11 at 18:20
    
Read my anwser, comment it. I also had problems with nautilus, maybe a bug, or not the right permission. –  B. Roland Jun 6 '11 at 18:25
add comment

2 Answers

up vote 3 down vote accepted

Use commands, from terminal. Ctrl + Alt + T by default, but you can find it in GNOME menu.

So open that terminal, and type:

sudo chmod 775 FILE(S) - for folders, use recursive option: sudo chmod 775 DIR(S) -R

The numbers are from the permissions: 7 means rwx(read, write, execute), 5 r-x(read, execute), 6 rw- (read, write).

The tree number combination is: ogx (owner, group, everyone).


To change group an owner, use:

sudo chown OWNER:GROUP FILE/FORDER -R eg. owner: root, group:users; (R=recursive)

To change group only, use:

sudo chgrp GROUP FILE/FOLDER -R ... same thing...

Please read the manual pages of these programes: man chmod chown chgrp - for more details.

share|improve this answer
add comment

You said "the permissions switch instantly back". What about "the permissions did not get applied"?

If you've a separate /var/www partition formatted FAT or NTFS, you need to reformat your partition as those filesystems do not support Linux file permissions.

Backup your files and re-format the partition as ext4. Next, copy the files back and restore the permissions and ownerships:

sudo chown -R 0:0 /var/www
sudo find /var/www -type f -exec chmod 640 {} \;  # files
sudo find /var/www -type d -exec chmod 750 {} \;  # directories

The 640 and 750 in the last two commands can be changed of course.

share|improve this answer
    
the problem is precisely because of the file system. Copy the things to a native linux partition ext2,3 or 4 and then check for change in file permission. –  Vineet Menon Oct 8 '11 at 5:24
add comment

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.