LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 08-31-2005, 07:29 AM   #1
bruse
Member
 
Registered: Feb 2005
Location: internet
Distribution: Debian
Posts: 821

Rep: Reputation: 30
chmod


shell i know the option 4777 or 4775.

these are frequently used by some guys.
 
Old 08-31-2005, 08:11 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
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...

Edit: Fully explained the first number...

Last edited by jtshaw; 08-31-2005 at 08:31 AM.
 
Old 08-31-2005, 08:39 AM   #3
bruse
Member
 
Registered: Feb 2005
Location: internet
Distribution: Debian
Posts: 821

Original Poster
Rep: Reputation: 30
sorry for short information.

and i look ur answer.and somethink related to my question. thanks anyway.

here is my question.

while using chmod command in linux.i know the options like 777 or 770 or 775.

but i saw some where that 4 is added b4 that?
that is

#chmod 4777 <file>

now may i know that option 4 ?
 
Old 08-31-2005, 09:17 AM   #4
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,644

Rep: Reputation: 145Reputation: 145
@ bruse
Read jtshaw's post again. The info you request is written there.

@ jtshaw
And thank you jtshaw for your good explanation, now I really understood the sticky bit for the first time
 
Old 08-31-2005, 09:43 AM   #5
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
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.

Yves.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Chmod Centinul Linux - Newbie 8 06-30-2005 10:44 AM
What can we do if we type chmod ugo-x /bin/chmod ?????? bunny123 Linux - Software 3 02-01-2005 08:53 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM
Chmod gibbylinks Linux - Newbie 1 10-23-2003 11:17 AM
chmod u+s csDraco_ Slackware 6 04-22-2003 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration