News: April 7, 2019 - TP Docs is now updated to Version 1.6.3...!

Search Articles


Search in titles
Search in article texts

Docs Navigation





Author Topic: What Is A Chmod?  (Read 6629 times)

Offline Xarcell

  • Full Member
  • ***
  • Posts: 137
What Is A Chmod?
« on: April 25, 2008, 04:16:38 AM »
Chmod is short for "change mode", a UNIX command that changes the access permissions of files or directories in order to read, write or execute files.

Various FTP programs have different routes about chmodding your files. However, I'm going to explain how to do this by default, with Internet Explorer.

To access your host files by default, open Internet Explorer(IE) and in the URL address bar type in: ftp://username:password@yourdomain . Or just type in ftp://yourdomain and a prompt will appear for your login info.

*Your username, password, and domain is your FTP access information to your server account, which may differ from your actual server login.

Once you are logged in, find the file you wish to chmod. Right click the file and you should see "properties". Click that and you should see a bunch of boxes. Check/uncheck the boxes as needed to suit your chmodding needs.

I have attached a screenshot below.


.:: ADVANCED ::.


Your chmod will appear in numbers or letters.

Example:
  • Numbers like  755 or 777
  • Letters like rwxr-xr-x     or rwxrwxrwx 

FIRST, let's tackle the numbers:

  • Read is given the value of     4
  • Write is given the value of     2
  • Execute is given the value of 1

This then is translated by adding the values together for each of the groups of permissions.

Therefore if setting permissions for the file as in the Table above:

  • User can read(4), write(2) and execute(1)  ::  4 + 2 + 1 = 7
  • Group can read(4), and execute(1)            :: 4 + 0 + 1 = 5
  • World can read(4), and execute(1)             :: 4 + 0 + 1 = 5

In this case permission would be 755.

If the group could write as well read and execute Group would = 4+2+1 =7. Therefore the permission would be 775.

SECOND,  let's tackle the letters:

Basically this is the same as the numbers but using letters instead of numbers:

  • Read        = r      (4)
  • Write       = w      (2)
  • Execute   = x      (1)

So to set permission to 765  as above it would translate to: rwx rw- r-x ,

OR to set to 777 : rwx rwx rwx
OR to set to 644: rw- r--   r--

644 meaning owner can read and write and group and world can read only.

# Letters Extended:

Working with letters is slightly more complicated and is detailed below.

Besides the letters relating to the permissions  r  w  x, there is another set of letters  relating to sets of permissions:

  • u    User
  • g    Group
  • o    World or Others
  • a     All the above

Permissions are granted with the following operators:

  • +    Add a permission
  • =    Assign a permission
  • -     Remove a permission


Format    chmod   usr|grp|othr  operator  permission


EXAMPLES:


  • chmod  ugo=rwx filename

This would assign the file filename in the current directory read write and execute permissions to the user group and others (world) (777).

-------------------

  • chmod  u=rwx,go=rx filename

This would assign the file filename in the current directory read write and execute permission for the user and read and execute only for the group and world (755).

-------------------

  • chmod  go= filename

This would clear all permissions for group and the world for the file filename.

-------------------

  • chmod  o-x *.cgi

This would remove execute permission for the world for all files with the extension cgi.

-------------------

  • chmod  u=rwx,go=r directory

This would set the directory named directory and all files and subdirectories in it to user read write and execute the group and world to read only (744).

-------------------

  • chmod  go+w directory

This would add write permission for the group and world to the directory named directory and all the files and subdirectories in it.



Doc Written By: Xarcell