Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm not sure exactly what your question is here... but I can tell you what those mean.
Lets start by ignoring the first number (the 4) and taking the last three numbers.
The first of the last three numbers is the "owner permission", the 2nd of the last three numbers is the "group permission", and the last number is "others" or "world".
There are three bits of importance for each number. The Read, Write, and Execute bits.
100 binary (aka 4 in decimal) means read only.
010 binary (aka 2 in decimal) means write only.
001 binary (aka 1 in decimal) means execute only.
To give multiple permissions you just add them. 110 (or 6, aka 4+2) means read and write. 101 (or 5) means read and execute. 111 (or 7) is read, write, and execute. These aren't all the combinations, but you get the idea.
So, 777 means the files owner, group, and others can read, write, and execute the file. 775 on the other hand means the files owner and group can read, write, and execute while others can only read and execute.
Now comes in the first number. It works exactly the same as the others but each bit means something different.
100 binary (aka 4 in decimal) means the program will always execute as if the owner ran it.
010 binary (aka 2 in decimal) means the prrogram will always execute under the owning group.
001 binary (aka 1 in decimal) is the "sticky bit". This means the program stays in memory even after execution is complete for faster startup next time. Typically you don't need to set the sticky bit on things unless it will be running over and over on a very short cycle.
You can combine these just like you could the read, write, and execute permissions. If you only use 3 numbers in your chmod it assumes the special bits are 0's. "chmod 0777 <file>" is the same as "chmod 777 <file>". "chmod 4770 <file>" isn't the same as "chmod 477 <file>".
Now... hopefully that was something on the line of what your looking for...
Wow jtshaw, I'm tempted to bookmark your post, to refer people back to it when needed... Done, bookmarked
Just edit it to add this last bit of information:
First number when applied to directories:
100 binary (aka 4 in decimal) means that files and dirs created inside this directory by users have the same owner as this directory, not that of the user.
010 binary (aka 2 in decimal) means that files and dirs created inside this directory by users have the same group as this directory, not that of the user.
001 binary (aka 1 in decimal) is the "sticky bit". This means that files and dirs created by a user in this directory can only be removed by this same user, even if everyone has writing permission on the directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.