Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

System file: ext4

I changed the owner of files to apache: with the command:

chown -R apache: wp.localhost

Then, I could not change the permissions of directories in wp.localhost nor the wp.localhost itself

I use the command chmod +w wp.localhost for example. and I do not see any permission change on it.

I also changed the group of folders by the command again, But did not solve the problem.

chown -R apache:users wp.localhost

Commads and permissions before and after:

#ls -ld wp.localhost
drwxr-xr-x 6 apache users 4096 Mar 28 15:26 wp.localhost/
# chmod +w wp.localhost
# ls -ld wp.localhost
drwxr-xr-x 6 apache users 4096 Mar 28 15:26 wp.localhost/
share|improve this question
    
Can you include the output of ls -ld wp.localhost before and after the commands you say don't work? –  Flup Mar 28 at 12:05
    
@Flup: sure, added to question. –  Mohammad Etemaddar Mar 28 at 12:08

1 Answer 1

up vote 6 down vote accepted

If you want to grant global write permission on that directory, you have to do

chmod a+w wp.localhost [1]

This is because omitting the 'who is affected' letter (u, g, o or a) implies a, but won't set bits that are set in your current umask. So, for example, if your umask was 0022, the 'write' bit is set in the 'group' and 'other' positions, and chmod will ignore it if you don't specify a explicitly.

The chmod man page is explicit about this:

If none of these ['who is affected' letters] are given, the effect is as if a were given, but bits that are set in the umask are not affected.

[1] Think carefully before doing this!

share|improve this answer
    
You are right, I used chmod g+w wp.localhost and worked correctly, Thanks –  Mohammad Etemaddar Mar 28 at 12:20
    
But I have a question. On normal conditions the letter of 'who is affected' does not needed for giving permission to all. Why now became necessary? –  Mohammad Etemaddar Mar 28 at 12:23
    
Impossible to say what's changed. Perhaps your umask has changed. –  Flup Mar 28 at 12:35

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.