LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-03-2006, 05:20 AM   #1
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Permissions


I didn't understand something in permission I think it's must-know for me to continue work in linux.

I got all the 777 permissions, but I need to understand

in Octal, what does every one of this means :

Read (1,2,4)?
Write (1,2,4)?
Execute (1,2,4)?

Also,
What does Execute? why do I have to get that permission to do something? what?

If I got no read permission, I can't view the file content, but I can see it's name? How can I make it hidden?

Write? = changing the file?


Thanks alot,

Zuki
 
Old 02-03-2006, 05:33 AM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 49
read = 4, write = 2, execute = 1

the three digits are permissions for each of the three classes:
1. user - owner of the file
2. group - people other than owner who are in the group of the file
3. other - people in neither of the above

for files (pretty self explanatory):
read - read the file
write - write to file
execute - allows you to execute it as a command

for directories:
read - allows you to list the directory (get the names of the contents)
write - allows you to create/delete/move things in the directory
execute (most important) - allows you to access the contents of the directory
 
Old 02-03-2006, 05:33 AM   #3
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Read = 4
Write = 2
Execute = 1

First number is for the owner of the file, the second is for the group and the last is for all.
Execute is straightforward : the file is executable (scripts, binary programs).
Write is for modifying the file.
Read is to view its content.
To hide a file, put it is a directory without execute permission.
If you name a file with a . prefix, the file is hidden but it's easy to see it with good glasses.
 
Old 02-03-2006, 07:39 AM   #4
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by spooon
execute - allows you to execute it as a command
so 777 means everyone, owner, and group, can read write and execute the file right?




Can you explain this sentence please?

Code:
execute - allows you to execute it as a command
Maybe an example, I havn't fully understand.
 
Old 02-03-2006, 08:37 AM   #5
SpiderIRE
Member
 
Registered: Jan 2005
Distribution: FC (Planet CCRMA Kernel)
Posts: 81

Rep: Reputation: 15
execute in the most basic sense means run! say the file your trying to execute/run is the apache's httpd, the only person who can start this with a command like:

#/usr/local/apache2/bin/apachectl start

is the owner of the file!

I googled linux permissions and the first site that appeared was http://www.zzee.com/solutions/linux-permissions.shtml. I took a very quick look at it and it might explain a few things!

But i'll hopefully not confuse you with this bit! If you don't like using the numbers for permissions you can use this format:

chmod ugo+rwx [filename]

this chmod's the file so that everyone has read write and execute permissions! try and figure this out the letters way by yourself! your learn an awful lot!

-David
 
Old 02-03-2006, 02:47 PM   #6
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
Thanks.,...
 
Old 03-06-2006, 04:55 PM   #7
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
can I put different permission to different groups on the same file?

Lets say I have groups : A,B,C,D,E,F,G

and I want group A to have permission 1 (only execute)
group B - 2 (only write)
C - 3 (write + execute)
D - 4 (Read Only)
E - 5 (Read and execute)
F - 6 (Read and Write)
G - 7 (Read, Write and Execute).


is it possible?
 
Old 03-07-2006, 03:00 AM   #8
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Yes, it is, at least with ACLs (Access Control Lists). Try looking at the getacl and setacl commands.

In most cases, but maybe not in the example you've given (since this is indeed quite a complex example),
a combination of file ownership, group and file permissions can usually do the trick.
So, in practice, I'd try to stay away from ACLs if you can.

For instance, you could:
-make larger groups, that combine all members of the groups that have same permissions
-use special bits like the setUID and setGID bit to force the owner/group when executing the file.
-play around with the permissions on the parent directory (or any of the parent directories in the full path of the file).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 01:00 PM
permission ... permissions .... permissions alaios Linux - General 1 05-31-2005 05:16 AM
Permissions The Patbon Mandriva 2 03-16-2005 06:31 PM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 01:52 PM
Permissions Rubicone Linux - Networking 2 03-11-2002 08:13 PM


All times are GMT -5. The time now is 10:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration