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

Switches - 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

Switches are also known as line options in Linux. These line options are used to get output by the main command (our case being the chmod command). I’m going to explain only two switches, but remember, there are many resources out there that can show you more switches. The switches are the -R (Recursive) and -v (verbose) switches. NOTE: UNIX/Linux is case-sensitive!

The -R (Recursive) switch is a very powerful switch. It allows you to recursively (ahh, that’s why they call it that!) command the chmod command to not only change the mode to the directory you specify, but also the directory’s subfolders. As I said, it is very useful. Suppose that we have a folder called Test and it has four sub-directories called: Production, Alpha, Beta, and PR, respectively. The problem is, we are limited in time, and we have to make these kinds of changes on a Linux machine to about 400 other Linux machines, so we have to be able to do it fast.

GUIs (Graphical User Interface) are cute, but also very slow. A directory at a time is still slow, even though it is much faster than using a GUI. So our only alternative is to use the -R switch for chmod; remember we are changing modes. Let’s see how we would do this in an example:

Bash

  • chmod -R 755 /Test

What we are doing here is telling the chmod command to give the owner Read, Write, and Execute permissions. Groups that are assigned to the file get Read and Execute permissions; World (other) also gets Read and Execute permissions. We will go into modes later. While giving permissions to the three types on objects, we are telling it to do this to the Test directory and all of its sub-directories.

Next I will discuss using the -v (verbose) switch. This is probably one of my favorite (still useful) commands that UNIX/Linux has, and is usually used for a lot of different commands. The -v (Verbose) switch just outputs what the chmod command is doing. It tells you it is assigning permissions, to each directory, where it is, and any errors is has along the way.

Again, suppose that we have a folder called Test and it has four sub-directories called: Production, Alpha, Beta, and PR, respectively. To really show you output of this, you should try it out for yourself. It’s neat, but looks crazy. You would use the -v (verbose) switch in case you are a computer nut and want to just see what’s happening, need to find out why something isn’t working (troubleshooting), or need to just make sure everything is doing what it is suppose to be doing. Let’s see how we would do this in an example:

Bash

  • chmod -v 755 /Test

Before I go any further, remember what I said about case-sensitivity; I meant it, so be aware. Since you should know what the above example is saying, I’ll be brief. The only difference with this command is it displays everything that is happening from the chmod command’s start to end. Everything else is the same. If you need to read over this section again, please do; we are now going into the really fun part, modes.



 
 
>>> 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: