|
Guides All Guides and HOWTO's. |
|
Thread Tools | Display Modes |
|
|||
Semi-brief introduction to file permissions,
Often you may see someone setting permissions using octal values, this may be confusing at first, but I'll try to help you out.
First, let's say someone sets the permission 666 on a file, you may have a chill run up your spine if you're religious, but it's honestly a very liberal number.. Octal, or base 8, has 8 possible values.. 0 through 7. Binary, or base 2, has 2 possible values.. 0 and 1. Binary is important in computing because it represents 2 universal states, ying and yang, right and wrong.. on and off. 1 is the equivalent of true. 0 is the equivalent of false. So, 6 octal is 110 binary.. The first 2 binary digits of 6(110) represent the read and write permissions of the file, the last digit represents execute. So, When you see "666", the first digit represents the owners permissions, the second digit represents the group permissions, the last digit represents "everyones" permissions. In this case, everyone can read and write.. but nobody can execute the file. Here is a basic reference:
I should note, occasionally you may see permissions set as 4 digit octals.. For example: $ chmod 0666 public_doc.txt
I hope I helped somebody out, take care, feel free to post if you have questions. Last edited by BSDfan666; 5th June 2008 at 01:03 AM. |
|
||||
Thanks, I don't think I've actually ever seen it written out that way before.
I get the chmod flags in octal, I understand the logic of the binary representation readily, but for the life of me I don't think I'll ever convert octal to binary without a headache >_> If man had been meant to count in octal, he would have been created with 10 fingers.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
The chmod (1) man page also documents how to use symbolic notation to change the mode of a file.
For example to set the execution bit for the owner/user of the file Code:
chmod u+x
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Quote:
Last edited by BSDfan666; 5th June 2008 at 10:31 PM. |
|
|||
Thanks, this was helpful
|
Tags |
binary, chmod, octal, permissions, unix |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Permissions error | J05HYYY | NetBSD Package System (pkgsrc) | 1 | 7th October 2009 11:05 PM |
Permissions for zzz / acpiconf | Mantazz | FreeBSD General | 0 | 15th September 2009 10:43 PM |
permissions and FTP/HTTP | Yuka | FreeBSD General | 0 | 20th October 2008 10:32 PM |
Designing BSD Rootkits: An Introduction to Kernel Hacking | cajunman4life | Book reviews | 2 | 21st June 2008 03:27 PM |