LinuxQuestions.org
Visit Jeremy's Blog.
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 09-23-2004, 12:55 PM   #1
Adan
Member
 
Registered: Aug 2004
Location: Lithuania
Distribution: Debian 3.1rev1
Posts: 38

Rep: Reputation: 15
How do I use chmod?


I want to change permissions for some folders, I know chmod is used for that, but I don't know how is it used, man chmod doesn't do any good to me, I don't understand a thing it says... What do those numbers, for example 755 and so on, mean?
 
Old 09-23-2004, 01:07 PM   #2
justin_p
Member
 
Registered: Jan 2004
Location: Virginia, USA
Distribution: slack 13; I've used it all :)
Posts: 433

Rep: Reputation: 30
Always try a search engine first. google.com and ask.com seem to be the best. here are the results i got for searching "What do the numbers in the chmod command mean?" on ask.com; might be worth a look.http://web.ask.com/web?q=What+do+the...%3F&qsrc=0&o=0

Last edited by justin_p; 09-23-2004 at 01:10 PM.
 
Old 09-23-2004, 01:08 PM   #3
mirradric
Member
 
Registered: May 2004
Location: Singapore
Distribution: Debian woody and debian sarge
Posts: 188

Rep: Reputation: 31
the 3 numbers represent ,from left to right, permissions for the owner, group, others respectively. A 1 represents that the file is executable and for directories it means you can access it. A 2 means you can write to the file or directory. A 4 means you have read access and for directories you can display (ls) it's contents. A 5 is 4 + 1, a 6 is 4 + 2, 7 is 4 + 2 + 1. Each means the combination of what make them up. Eg. 6 means read and write.

actually if you are really into it, these are 3 octal digits (base 8).
In binary
1 is 001
2 is 010
4 is 100
5 is 101
6 is 110
7 is 111
..... rwx
 
Old 09-23-2004, 01:10 PM   #4
dxdad
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 75

Rep: Reputation: 15
http://www.wbglinks.net/pages/reads/...rmissions.html
 
Old 09-23-2004, 01:17 PM   #5
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
Ah the numbers

The mysteries of Chmod explained:
basic syntax:
chmod 777 filename
what it means:
first number = User (what permissions do you want the user to have)
Second Number = Group
third number = Other (everyone else)

Now what the numbers mean:
0=No permissions
1=x (execute)
2=w (write)
4=r (read)
Then you can add the numbers so if you wanted to do more than one like:
full permission
rwx=4(r)+2(w)+1(x)=7
Read/Write
rw-=4(r)+2(w)=6
Read/Execute
r-x= 4(r)+1(x) =5

So chmod 765 junk would do the following:

blink@sanity ~ --> chmod 765 junk
blink@sanity ~ --> ls -l junk
-rwxrw-r-x 1 blink blink 3 Sep 23 12:15 junk
blink@sanity ~ -->
 
Old 09-23-2004, 04:57 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Of course I always use the letters instead; works just as well and easier to use. eg
chmod u=rw file
sets user perms to rw (read/write)
 
  


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 09:44 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