// post · 276

Basics of chmod.

·

Chmod is the *nix way of handling file permissions. Often you will be asked to make sure to chmod a file with permissions such as 755. What does this mean?

Have a look at this table:





























Owner Group Others
R W X R W X R W X
4 2 1 4 2 1 4 2 1


There are three groups. Owner, Group and Others.
Owner is often you, the person who created the file or folder. Group is the users who share the same group as you. Others is everyone else.
Now with file permissions we have 3 options. R (for Read), W (for Write) and X (for eXecute).
Under these options in the table you will see a number. 4 for read, 2 for write and 1 for execute.

Just say we wanted to give permissions to everyone to read, write and execute a file the chmod number would be:
777 ((4 + 2 + 1)(4 + 2 + 1)(4 + 2 + 1))

If we just want the owner to have these permissions it would be:
700 ((4 + 2 + 1)(0 + 0 + 0)(0 + 0 + 0))

For read and write for the owner and read only for everyone else it would be:
644 ((4 + 2 + 0)(4 + 0 + 0)(4 + 0 + 0))

And so on.

To chmod a single file we use the command:
chmod 777 filename

To chmod a folder we use the command:
chmod 777 foldername/

To chmod a folder and all files and folders inside we use:
chmod -R 777 foldername/

To list the files and permissions of a certain folder use:
ls -l

Anyway I hope this maybe useful for someone. Maybe if you have shell access on a *nix machine or something.

// comments

· Matthew guest
Remember after chmod -R 777 /windows
Then need to do: chown matthew:users /windows

Where matthew = user and users = group name.

To make permanent changes if your file or folder is in a particular partition. You need to change your /etc/fstab, to change boot permissions so you do not have to do chmod everytime you start Linux. Dale =p.

BTW (BY The Way), had to do this so, I can read my Windows partition from Linux. =) My kernel already has NTFS read&write driver compiled in of course.

// leave a comment

> click for comments help

HTML allowed: <a href="" title="" rel=""></a> <b></b> <blockquote cite=""></blockquote> <em></em> <i></i> <strike></strike> <strong></strong> <li></li> <ol></ol> <ul></ul>
ie: <b>bold</b>

Your comment may need to be reviewed before it is published.