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 04-28-2007, 04:47 PM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Understanding permissions


Regarding file and folder permissions, I'm having some trouble understanding the difference between them. For files it seems pretty straightforward (is it?), but what exactly does read, write, and execute mean for folders?

I've seen a few contradictory explanations in the last little while, so I'm hoping somebody here could clarify.

My other question relates to dependencies between RWX permissions. For files or folders, is there any requirement that a something with X permission must have R, or any sort of dependency like that, or are they all truly independent?

I'd imagine with folders there might be some element of that...but I'm really not sure.

Your explanations on these issues are greatly appreciated.
 
Old 04-28-2007, 05:20 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Should be lots of good info on the net, but here are the very basics:
For any given file or folder, there are 3 'people-categories' for whom there may be permissions: USER, GROUP, and OTHER. USER means the owner of the file. Group means what 'group' of users who might access the machine, and OTHER means anyone on planet earth (Any user, any Group) who is using the machine.
For each of those 3 caterories there are 3 BASIC permissions:READ, WRITE, and EXECUTE.
READ means those people allowed, may READ the file. WRITE means those people allowed, may WRITE TO or CHANGE the file. And EXECUTE means those people allowed can EXECUTE or RUN the file (if it's a script or a binary, for example).
So, for any given file or folder, you must set WHO is allowed to do WHAT with a given file.

Search LQ here for things like PERMISSIONS, SUID, ACCESS, and stuff like that. There are other threads around with lots of info.
NOTE: These were the BASICS. There is also SUID, GUID, and STICKY which are three 'extra' special permissions, but that's a long story, which you will get the hang of if you read a bit.
Also, in a console, type 'man chmod' or 'man chgrp' for further info. For the most part, each permission is independant of each other. For example, a file can be USER(root)=RWX, GROUP(humans)=RW, and OTHER(anyone)=RX. (These would be rather silly settings mind you ) but they would mean that the ROOT user could read, write, or execute the file. Anybody in the group 'humans' could read or change the file, but not execute it. And anyone at all could read or execute the file. As I said, stupid permissions, but it's only an example.

Last edited by GrapefruiTgirl; 04-28-2007 at 05:25 PM.
 
Old 04-28-2007, 09:30 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
A bit more detail:
Read, write, and execute are totally independent.

Permissions for directories are slightly different. for example, to look inside a directory--even only to read--you have to have execute privileges on the directory. If you don't have read privileges on a directory, you cannot ls to see the files, but you CAN read the files (if you have permission for them).

The best way to get you head around this is to do some experiments.
 
Old 07-18-2007, 04:21 PM   #4
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Quote:
Originally Posted by GrapefruiTgirl
For example, a file can be USER(root)=RWX, GROUP(humans)=RW, and OTHER(anyone)=RX. They would mean that the ROOT user could read, write, or execute the file.
User "root" is special; it can normally read and write any file, regardless of permissions.
Quote:
Anybody in the group 'humans' could read or change the file, but not execute it. And anyone at all could read or execute the file.
Not true, 'humans' cannot execute the file. That is anyone having 'humans' as their primary or an auxiliary group. The OTHER permissions only apply to people other than the owning USER or GROUP.
 
  


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
LXer: Understanding Linux File Permissions LXer Syndicated Linux News 0 04-05-2006 07:21 PM
Understanding File Permissions username132 Linux - Software 13 04-03-2006 04:42 AM
Understanding linux package building and user permissions MOPAULY Linux - Newbie 5 01-24-2006 11:39 AM
Understanding permissions - from a Windows user's perspective floydian219 Linux - Newbie 12 09-07-2004 08:10 AM
Trouble understanding chmod & group permissions gen-ik Linux - Newbie 3 07-19-2004 01:51 PM

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

All times are GMT -5. The time now is 07: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