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 have a directory called sai at /var/www/html/. I gave permission initially 755 and tried 777. I have loggen in as user nitish. When I tried to edit the files , it says the file is read-only. But if I edit files through terminal logging as root, I can edit the same files. Below is ls -l command output:

[root@localhost sai]# ls -l
total 48
-rwxr-xr-x. 1 root root 5508 Mar 30 15:40 build-my-website.html
-rwxr-xr-x. 1 root root  674 Mar 30 15:40 check.html
drwxr-xr-x. 3 root root 4096 Mar 30 15:40 css
drwxr-xr-x. 2 root root 4096 Mar 30 15:40 images
-rwxr-xr-x. 1 root root 9002 Mar 30 15:40 index.html
drwxr-xr-x. 2 root root 4096 Mar 30 15:40 js
-rwxr-xr-x. 1 root root 4589 Mar 30 15:40 overview.html
drwxr-xr-x. 4 root root 4096 Mar 30 15:40 slider
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

File permissions aren't inherited from parent directory on change. This is what ls's first column means: (rwx is read, write, execution)

[directory] [owner perms] [group perms] [everybody else's prems]
     d           rwx           r-x                r-x

As you can see, only owner (root, third column of ls) can write to the file. You can use chmod to allow everybody edit these files:

chmod go+w *

or:

chmod a+w *

First command means:

Allow (+) group members (g) and others (o) write (w) to the file, for all files (*).

Second one is

Allow everybody (a) write to the file.

share|improve this answer
    
Thank you very much..I have been looking for this answer . Thanks for the explanation –  Nitish Mar 30 '13 at 12:00
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.