Find programmers and grapic design experts at ScriptLance.com
<? DEW-CODE.COM  

Downloads

Assorted scripts  (1)
DewNewPHPLinks  (7)





Lost Password?
No account yet? Register

Dew-Code Newsfeed

More Dew-Code Stuff

Tech & Net Video
Many people seem to the think Dew-Code.com is run by a group of people, or some big corporation. Well, it's flattering if you have that impression, but the truth is, its just one person. While I'd love nothing more than to continue giving away my scripts, my time and experience, I do have the same needs as everyone else. If you've found Dew-Code.com , or any of the scripts found there to be helpful, please consider making a contribution.

For the year 2008, as of 10/1/06, A total of $155 USD has been contributed, or roughly $15.50 per month, for the year. While that is of course appreciated, unless more contributions are received, I will have no choice but to make future scripts available for purchase only.

Regards,
Dewed
Dew-Code.com

CHMOD Whats with those numbers? E-mail
If you use Linux, or just maintain a website, you have undoubtedly had to do something to adjust permissions on a file or a directory. With many of todays programs handling the details for you, I find there are many otherwise experienced webmasters who don't have a clue how the Linux file permissions work. Well hopefully after reading this, it'll be as easy as 123 , or rather 4 2 1

So you've like read some directions somewhere out there with something like

chmod the file 755  and the directory 700

 

First off, the chmod command .. this is Linux'ese for CHange MODe , eg; changing the mode of the file, besides permissions, it can also change something called a sticky bit .. but I'll save that for a later time.

 

So what about those numbers ?

 

There will always be 3 digits, sometimes 4, with the first being zero, like

  

0755  and 755

 

These are identical as far as chmod is concerned, so for simplicity I'll stick with the 3 digit format. 

 

The first number, sets the permissions of the file owner. That is most likely you, or possibly your webserver's process

 

The second number sets the permissions for the group members, but today this is rarely used since the typical Linux user is in a group of one.

 

The last number sets the permssion for everyone else, as such, its the one that will most likely cause issues if incorrect. Its also the one you should as conservative as possible with..

 

Ok, so what do the numbers mean ?

 

You can have 3 different kinds of access to a file.

The right to read the file

The right to write to the file

The right to execute the file

 

Got it?   Read  Write Execute ... 

 

The number to give only read permissions is 4

The number to give only write permissions is 2

The number to give only execute permissions is 1

 

Repeat after me ...

Read  Write Execute   4 2 1

Read  Write Execute   4 2 1

Read  Write Execute   4 2 1

Read  Write Execute   4 2 1


Good...   so lets say, the file owner need full permissions on a file, but wanted to keep private data in it, no one else should be able to do anything to the file...

 

chmod 700 private_file.txt

 

 

Ok.. perhaps, we'll allow just members of our group to view the file content by giving them read (4) permssions

 

chmod 740 private_file.txt 

 

 

Ok, maybe the info isn't so private anymore.. allow anyone to read the file 

 

chmod 744 private_file.txt  

 

Perhaps allow group members to edit the file, by adding write (2) permissions ..

 

chmod 764 private_file.txt  

 

Typically, files that make up a wbesite should be 

chmod 755 

 

Full permissions for the file/directory owner, read and execute permissions for everyone else.

 

BUT.. sometimes, you need something different. Hopefully this little note will help you to determine what permissions you actually need, and how to make that change yourself.

 

Regards,

Dewed

 

 

 

 

 

 

 
Tag it:
Delicious, Digg, MyYahoo, Technorati, Furl and 50 more!
< Prev   Next >

Freelance Jobs

See more freelance oppurtunities


Newsflash

Sign up for PayPal and start accepting credit card payments instantly.
Copyright Dew-Code 2008