0

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

1 Answer 1

2

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.

1
  • Thank you very much..I have been looking for this answer . Thanks for the explanation
    – Nitish
    Mar 30, 2013 at 12:00

You must log in to answer this question.

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