chown step-by-step as an example

ZIYAD A. M. AL-BATLY zamb at saudi.net.sa
Mon Aug 8 11:46:33 UTC 2005


On Mon, 2005-08-08 at 11:05 +0200, J.Markoll wrote:
> Hello,
> I find it is a good example to understand better how the rights on files
> function.
> In the 'sudo chmod -R a+rX,go-w /home/upload' command,
> chmod #change rights
> a     #all
This is all true.

> +rX     #give rights to read (r) and gives rights to execute (X) I suppose ?
Yes.  'x' and 'X' differ in that 'x' will give 'eXecute' permission all
the time, while 'X' will give that permission if the owner have execute
bit set already.  Try with some files/directories to find out more.  'X'
is very useful when changing the permission for a lot of files that some
of them need the execute bit set, or a mix of files and directories and
you want to grant execute bit for directories but not for files (or a
mix of both cases).

> so 'g' groups, and 'o' others, will have the write (w) suppressed ?
Correct.

> Thus nobody has the rights to write, among 'all', 'group' and 'others'.
> Then the only one who will have all the writes will be root, being the 
> owner of the folder.
Some what: Yes.  The above command ensure that "group" and "other" don't
have any write permission only.  This doesn't mean that the "user"
already have those rights.

The owner most have that right already if he/she wants to write to those
files/directories since in the above command, no "write" permission was
granted to that user for sure.  Of course, the special case user "root"
have super privileged, and thus need not any file-system permission for
him/her to write to files.  Scary!

> Did I understand perfectly ?
> J.Markoll.
> 
> 
Yes and thanks for your illustration.  It made it very easy for anyone
who doesn't know what "chmod" do.

Thanks again.
Ziyad.




More information about the ubuntu-users mailing list