LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-05-2004, 11:11 AM   #1
AmdMhz
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Debian, OpenSUSE
Posts: 142

Rep: Reputation: 15
Chmod Codes list


Hi all

Anyone have a link to all the Chmod Codes there are and their meanings? I want to copy it in a text file for me.

Thanks guys
 
Old 02-05-2004, 11:22 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
all of them are listed in man chmod, but I will type them out here as well.

I am assuming you don't want the binary codes, though I quite like them, so here are the text codes:

u = user
g = group
o = other (not user or group)
a = all

+ = add permissions
- = remove permissions

r = read
w = write
x = execute
t = sticky bit

so to add read permissiones for people in the files group I would do chmod g+r file.

I think that is it, there might be some other options as well, consult the man page.
 
Old 02-05-2004, 11:32 AM   #3
AmdMhz
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Debian, OpenSUSE
Posts: 142

Original Poster
Rep: Reputation: 15
Thanks, I guess I didnt make myself very clear. I am confused on the codes this why.

777
644
600

That is pretty much what I am looking for.

Thanks for the other codes though
 
Old 02-05-2004, 11:36 AM   #4
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
0 == --- == no access
1 == --x == execute
2 == -w- == write
3 == -wx == write / execute
4 == r-- == read
5 == r-x == read / execute
6 == rw- == read / write
7 == rwx == read / write / execute
 
1 members found this post helpful.
Old 02-05-2004, 11:45 AM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Ya, they are binary codes and the layout is rwxrwxrwx where the 1st rwx is user, 2nd rwx is group, and the 3rd is other. Put a one in the spots you want enabled, a 0 where you want disabled. And then convert the result of each group into decimal. For instance 101 (r-x) = 5.
 
Old 02-05-2004, 12:00 PM   #6
AmdMhz
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Debian, OpenSUSE
Posts: 142

Original Poster
Rep: Reputation: 15
That just confused me to the point my head hurts. LOL
 
Old 02-05-2004, 12:11 PM   #7
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Fedora 30
Posts: 341

Rep: Reputation: 37
I drew a reference guide to chmod once and I always refer to it:

Code:
OWNER  GROUP   WORLD
r w x  r w x   r w x 
1 1 1  1 0 1   1 0 1 
  7      5       5  
  |______|_______|
         |   
        755
As long as you can count in binary it makes perfect sense.
This way you can set precise: read, write or execute access levels
to files based on: owner, group or world
where or when ever you want.

So read only would be 100 or 4.

000, 001, 010, 011, 100, 101, 110, 111
0, 1, 2, 3, 4, etc ....


Does this help your head any?
cheers,
alar
 
Old 02-05-2004, 12:12 PM   #8
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
ok well what he is trying to get across is that you only actually need the following :
1 === execute
2 === write
4 === read

cause he first states that each group has the available permissoins rwx ..
then now he states that if you want the outcome of the results to be for example r-x, which is read access, execute access, but no write access, then to make it a little easier just use 1's and 0's ....
so a - = not enabled
and either a r,w,x in a position means = is enabled

so in our example we have r-x .. so the following is true :
r = enabled (takes a value of 1)
- = write is NOT enabled (takes a value of 0)
x = execute is enabled (takes a value of 1)
so if you put them together you get 101 because the format is rwx .. got it so far

so if we look at the chart given above we see that read = 4 and execute = 1 so if we add 4 + 1 we get the answer of 5 ...

another quick example ...
we'll use the following -> --x
so if we break it down
- = read is not enabled (takes a value of 0)
w = IS enabled (takes a value of 1)
x = IS enabled (takes a value of 1)

so you put it together and you get 011 (keep in mind the format of rwx, and also our chart above), and add them together (0 + 2 + 1 = 3) you get the answer of 3


just noticed that someone else got to it before me in explaining this little journey, but with both posts i think you'll get a better understand of what jtshaw was trying to get across ...
 
Old 02-05-2004, 12:19 PM   #9
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
It's a bitmask, all possible combinations are represented by a unique number. You really only need to memorize 1, 2 and 4 (if there were more options would then go to 8, 16, 32, etc...) Just add the numbers together for the combinations. It's not that hard.
 
Old 02-05-2004, 12:26 PM   #10
AmdMhz
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Debian, OpenSUSE
Posts: 142

Original Poster
Rep: Reputation: 15
starting to make sense guys. Thanks. All I need to do is contiune to reread it till it sticks. I love this place. Everyone is so helpful and no one has an attitude about. Thanks for being so cool
 
Old 02-05-2004, 07:34 PM   #11
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
Thanks Alar. That makes it much clearer for me too. I never could grasp the octal representation but I think I have it now. Cheers.
 
Old 02-05-2004, 11:28 PM   #12
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
Really should use user, group and other instead of owner, group and world if you don't want to confuse people with things like chmod o+r. A newbie is more likely to think that grants the owner read permission than the world. There's no reason to make it more difficult than it really is IMHO.

Last edited by Crito; 02-05-2004 at 11:29 PM.
 
Old 02-05-2004, 11:52 PM   #13
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
DrOzz's method of figuring out the codes is great to learn but at some point everyone should be able to convert the oct and hex digits to binary and the reverse in there heads.

Ok, let me rephrase that, anyone who likes to work with computers.
 
  


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
Are the hex codes for colors in a jpg the same codes as used in html? abefroman Linux - Security 3 07-31-2005 03:21 PM
What can we do if we type chmod ugo-x /bin/chmod ?????? bunny123 Linux - Software 3 02-01-2005 08:53 PM
wireless channel list different from router's list heluani Linux - Laptop and Netbook 1 08-29-2004 10:04 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM
How to Compare the c/c++ codes muneebs123 Programming 4 02-19-2004 12:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:48 AM.

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