LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-15-2013, 06:17 AM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,124

Rep: Reputation: 190Reputation: 190
Linux Newbies Understanding file permissions


http://quickbytesstuff.blogspot.sg/
 
Old 05-15-2013, 10:45 AM   #2
Leo-G
Member
 
Registered: May 2013
Distribution: Cent OS 6
Posts: 32

Rep: Reputation: Disabled
Nice
 
Old 05-15-2013, 10:51 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,488
Blog Entries: 10

Rep: Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643Reputation: 1643
That's a good reference, a bit informative, but it doesn't show examples where someone would perform an
Quote:
ls -l
command and see the results, thus also seeing the details. It should also probably explain owners, groups, as well as permissions.

Wiew the results of a long directory listing

Code:
desktop:/bin$ ls -l | more
total 6660
-rwxr-xr-x 1 root root  818232 2010-04-18 21:51 bash
-rwxr-xr-x 3 root root   30200 2010-09-10 17:36 bunzip2
-rwxr-xr-x 1 root root 1269432 2010-04-22 16:04 busybox
-rwxr-xr-x 3 root root   30200 2010-09-10 17:36 bzcat
lrwxrwxrwx 1 root root       6 2011-02-21 10:47 bzcmp -> bzdiff
-rwxr-xr-x 1 root root    2140 2010-09-10 17:36 bzdiff
This is not all the files, just a quick example, but the point here is to examine two parts of this as examples:

bash is a file, because there is no 'd' at the start of it all.
bash has permissions for read, write, execute for the owner
bash has permissions for read, and execute for group, and world. Note that typically to execute, people should have read and execute together, or that's most common.
bash is owned by root, and in the root group.

bzcmd is a logical, or symbolic link which actually points to bzdiff, which is the next file in the listing, to me this is uncommon, many times a symbolic link will point to a file in a different directory entirely; however this is not illegal, just funny/odd that it happened to be a same directory file, next in alphabetical line.
bzcmd is owned by root, in the root group, and has read, write, and execute permissions for all: owner, group, and world.

If someone issues:
Quote:
groups <username>
they'll find out what groups <username> is in. Sudo may have to be used to perform this on other users.

chmod, chown, and chgrp are useful tools to manipulate permissions (chmod), ownership (chown), and group (chgrp).

But without even trying to alter these things, the knowledge of what the long directory listing is telling you is helpful to understand. And clearly when you create files, you'll see that your username becomes the owner.

Creating your own files is also controlled by the umask, which is a local environment setting. Basically umask is the inverse of permissions. If your umask is 022 then a newly created file by you will have the mode of 755. Because if you look at each digit. umask of 022 is 000 010 010 in binary. If you swap all the zeros and ones you end up with 111 101 101 which in decimal is 755. I'm leaving out special modes which one sees in the umask. Instead of 022, it's really 0022 how you express it in your profile. The first digit is used to control special modes, one of which is the sticky bit. I've never used it, it's an old convention and I'm not sure it's really widely used these days.
 
Old 05-17-2013, 01:45 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,124

Original Poster
Rep: Reputation: 190Reputation: 190
Thanks John Click on G+1 to recommend it to Google. Just below the blog article.
 
  


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
LXer: Understanding File Permissions: What Does “Chmod 777? Means? LXer Syndicated Linux News 3 12-04-2012 06:47 AM
[SOLVED] Lack basic understanding of permissions(apache permissions problem) cK` Linux - Newbie 7 04-09-2010 12:49 AM
Understanding file permissions issue Laserjock Linux - Newbie 2 05-11-2009 12:03 PM
LXer: Understanding Linux File Permissions LXer Syndicated Linux News 0 04-05-2006 08:21 PM
Understanding File Permissions username132 Linux - Software 13 04-03-2006 05:42 AM


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