Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> *nix File Permissions - An Overview
michaelper22
post Sep 25 2006, 01:15 AM
Post #1


-=Hybrid Bus=-
*********

Group: Members
Posts: 744
Joined: 2-November 05
From: My hybrid bus (in NYC), a computer
Member No.: 13,709
Spam Patrol



I was originally going to post this in a reply, but felt it would deviate from the topic.

Here's a brief overview of the three numbers in a permission "code":
-The first number is for the owner of the file. If you set a file at 600, the owner will have read and write access and everyone else is locked out.
-The second number is for the users group (users are placed into groups to get special rights sometimes). Generally you will not give write access to a user's group.
-The third number is for the rest of the world, including web users. Setting any value that will allow write access to the world is not smart (aka 666 and 777).

Explanation of the permission values:
-To get a permission value, you add up certain amounts, depending on what permissions you want:
-- 4 is equal to read access
-- 2 is equal to write access
-- 1 is equal to execute access (or, in the case of a directory's permissions, it equals directory listing access, meaning you can retrieve a listing of all the files in a directory).

Let's look at this in a real-world example:
We have Joe's web site. He has the web page file home.html, the directory scripts, and the script file contact.php, which is located in scripts:
/
/home.html
/scripts/
/scripts/contact.php

We should set the permisions for each file as follows, for the reason outlined:
-home.html: 644 - this will give the file write access to the owner, and read access to the rest of the world.
-/scripts/: 755 - this will allow the owner all rights (read, write, listing), and give outsiders everything but write access.
-/scripts/contact.php: 755 - this will give the owner full rights, as well as allow the script to execute under any user.

This is not an exhaustive guide to *nux file permissions, and don't take me for a Linux system admin. But it will help the average hosting user understand how to give permissions to his site's files.
Edit: Please note that if you include a file in a PHP script using the include(), include_once(), or the require equivelants, then you don't need to CHMOD the file that you're including.

This post has been edited by michaelper22: Nov 24 2006, 03:08 AM
Go to the top of the page
 
+Quote Post
gameratheart
post Sep 25 2006, 07:29 PM
Post #2


Privileged Member
*********

Group: [HOSTED]
Posts: 505
Joined: 14-November 05
From: Britannia!
Member No.: 14,287



Simple and to the point. Thanks for posting about this. I know a lot of people don't understand the concept of Permission Changing (or CHMOD as it is commonly known), so this will definately help!
Go to the top of the page
 
+Quote Post
beeseven
post Sep 26 2006, 11:22 PM
Post #3


Privileged Member
*********

Group: Members
Posts: 629
Joined: 26-February 05
Member No.: 3,995



You could throw in some stuff about AFS if you want... it's not too hard but it has its intricacies.
Go to the top of the page
 
+Quote Post
michaelper22
post Sep 27 2006, 12:56 AM
Post #4


-=Hybrid Bus=-
*********

Group: Members
Posts: 744
Joined: 2-November 05
From: My hybrid bus (in NYC), a computer
Member No.: 13,709
Spam Patrol



You're all welcome for this tutorial; but as I mentioned, it was designed to answer a particular question rather than be an actual tutorial.
QUOTE(beeseven @ Sep 26 2006, 07:22 PM) *

You could throw in some stuff about AFS if you want... it's not too hard but it has its intricacies.

What exactly is AFS?
Go to the top of the page
 
+Quote Post
special
post Sep 30 2006, 02:05 AM
Post #5


Advanced Member
*******

Group: Members
Posts: 116
Joined: 23-September 06
Member No.: 30,433



Bin there done that, there a site with this even with a permission counter http://www.ss64.com/bash/chmod.html more eassy
Go to the top of the page
 
+Quote Post
beeseven
post Sep 30 2006, 03:35 AM
Post #6


Privileged Member
*********

Group: Members
Posts: 629
Joined: 26-February 05
Member No.: 3,995



AFS stands for Andrew File System. It's used in some *nix networks (like my school's and probably others). Its permissions are kind of weird, but I guess it's not completely relevant for this tutorial.
Go to the top of the page
 
+Quote Post
kkrizka
post Oct 2 2006, 01:38 AM
Post #7


Member [Level 1]
****

Group: Members
Posts: 51
Joined: 2-October 06
Member No.: 30,906



This seems like a nice tutorial for people that just want to know what those numbers mean. But it would also be nice to give more background, maybe at the end or a seperate section, on how those numbers were created. Here is a short summary from what I know.

Seach number consists of 3 bits. The first bit is read, second is write and third is execute. Since each bit can be eighter 0 or 1, then 0 means that one dosn't have those permissions and 1 means that he has. Also these numbers are binary, so they can be converted into the decimal number system. So let's look at some examples:
r | w | x | in decimal
----------------------
1| 0 | 0 | 4 <--can read only, just like in your
1| 1 | 0 | 6 <--Can read and modify
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How To: Change Your Website's Index File(24)
  2. Transfer File Of Any Size Using Winsock Control(5)
  3. How To: Make A Simple Php Site(21)
  4. Using A Secure File Transfer Client(0)
  5. Unencrypted But Invisible File Storage(0)
  6. The Many Ways To Bypas File Hosting Annoyances(5)
  7. How To Fix Codecs And Movie File Problems(0)
  8. Starting Or Stopping Apache And Mysql Server Via Batch File(0)
  9. Flat-file Cms(4)
  10. How To Make A Simple File Based Shoutbox Using Php And Html(8)
  11. Install An Aef Forum Onto The Trap17(11)
  12. User Permission Function [php](3)
  13. Make A Moderately-secure Password System Using Javascript(4)
  14. Debug Exe Files(4)
  15. How To Extract The Audio From Youtube Videos(5)
  1. How To Create Pdf Files Using Free Tool(0)


 



- Lo-Fi Version Time is now: 8th October 2008 - 05:04 AM