PDA

View Full Version : chmod help please


itsalltropical
12-17-2006, 05:41 PM
Need help on permissions for PHPAdsNew config.inc.php file. After install the permission is set at 644 on the CNC. Doc tells me to do "chmod a-w config.inc.php" What number is this in the CNC. I have read and estimate it might be 444 but wanted ocnfirmation since I'm a newbie.

sheila
12-17-2006, 06:09 PM
For file permissions, the numeric equivalents mean:

1 = executable
2 = writeable
4 = readable

therefore
3 = 1+2 = executable and writeable but not readable
5 = 1 + 4 = executable and readable, but not writeable
6 = 2 + 4 = writeable and readable but not executable
7 = 1 + 2 + 4 = executable, writeable and readable.

and of course
0 = no permissions to do anything.

644 means the owner (6) has read/write perms, and group and others have only read perms.

chmod a -w

is a command that removes write permissions for everyone.
Thus, on a file that is 644 the command would remove write perms for the file owner, and set it to
444
(the group and owner didn't have write perms to start with, so they can't be removed from those users...)

Note that your scripts run under your userID, so when your scripts are running, they are YOU and do use the file owner permission setting.

Kevin
12-17-2006, 06:18 PM
Here is an alternative explanation (not that Sheila is wrong but there is an easier way for people who already understand binary)...

The rwx letters in the permission list directly map to binary numbers:

decimal binary text
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx

The average user probably doesn't need to know this however it comes in handy if you ever need to change your umask (which kinda works in the opposite direction) or if you need to change the special permissions on the 4th digit (setuid, setgid, and sticky).

--
Kevin
-There are 10 kinds of people in this world.... Those who understand binary and those who don't. :P

itsalltropical
12-18-2006, 11:13 AM
Thanks everyone - got it and this thread in a plastic protector in my reference manual!