|
|
|
|
![]() ![]() |
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 ![]() |
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 |
|
|
|
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!
|
|
|
|
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.
|
|
|
|
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 ![]() |
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.
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? |
|
|
|
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
|
|
|
|
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.
|
|
|
|
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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 8th October 2008 - 05:04 AM |