Home arrow Site Administration arrow Page 5 - CHMOD: Tool for Open Source Administration

Mentally Converting from “read/write/execute” to 777 - Administration

CHMOD (chmod) is a UNIX oriented command that means “Changing Mode.” It lets you change the mode (hence the name) of the file, or directory(ies) depending on how the chmod command is used. When I say “changing mode,” I mean giving the file a different permission scheme, respectively read, write, and execute. This command, by the way, is one of the most useful and most used commands in Linux.

TABLE OF CONTENTS:
  1. CHMOD: Tool for Open Source Administration
  2. chmod Reasoning
  3. Switches
  4. Modes
  5. Mentally Converting from “read/write/execute” to 777
By: Drew Decker
Rating: starstarstarstarstar / 31
December 05, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Now we go through the process of converting the -r, -w, -e modes, to the numerical (faster) way of implementing a chmod command. Remember how I said that the first three bits in binary (read 4, 2, 1) are what are used for read, write, and execute? That’s what we use. Look at Figure 2 to see this in a graphical implementation.


Figure 2

But that’s just one number. Yes, that one number is the first number, which is used for the owner. We still have two other permissions to set: one for group and one for world. You do the same for group and world as we did for owner: convert the textual (read, write, execute) permissions to the octet (777) permissions.

As we do this over the process, we come up with a situation. We need to set the following permissions for a file called test.txt: owner = read, write, execute; group = read, execute; world = read. This is our practical example. The permissions would be: 754. To get this follow Figure 3 as a guide.


Figure 3

So by way of the guide, you just add up the numbers that are “on” and leave out or put a zero (0) in place of an “off” number. You get your number and you go to the next object. When you are finished you come out with three (3) numbers; this is the chmod mode you are going to use. Remember that your mode is just permissions, so if you want to set certain permissions, your mode will change.

Using the Octet version of chmod in UNIX/Linux

Now that we know how to convert from mode permissions using -r, -w, -e to 777 (note: it's not always 777, it could be 755 -- it’s dependent on your permissions), we can now use this methodology in a UNIX/Linux environment. Say that we want to do a basic chmod, giving the owner read and write access, group write access, and the rest of the world read access to a file called text.txt. The following would be the correct way to do it:

Bash

  • chmod -v 624 test.txt

That’s it! Take if from here, explore more ways of using the command line syntax. Don’t just look at it from the chmod perspective, look up other commands and compare them. Most of all, have fun and learn something new! Hope you enjoyed the article and that it helped you.



 
 
>>> More Site Administration Articles          >>> More By Drew Decker
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: