0

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?

2
  • 1
    what happens if you changed file permission from the command line?
    – Lie Ryan
    Jun 6, 2011 at 18:20
  • Read my anwser, comment it. I also had problems with nautilus, maybe a bug, or not the right permission.
    – antivirtel
    Jun 6, 2011 at 18:25

3 Answers 3

3

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.

3

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.

2
  • 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. Oct 8, 2011 at 5:24
  • Was directed from here: stackoverflow.com/questions/42433649/… This was my exact problem. I have no knowledge about file systems but when you mentioned permissions are not even applying I knew that was it.
    – Jordan
    Jun 6, 2017 at 17:20
1

Just change the owner of the folder by opening a terminal and:

sudo chown myUsername:myUsername -R /var/www

Where myUsername is your username

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .