Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-15-2013, 05:17 AM   #1
Senior Member
Registered: Apr 2010
Posts: 1,311

Rep: Reputation: 223Reputation: 223Reputation: 223
Linux Newbies Understanding file permissions
Old 05-15-2013, 09:45 AM   #2
Registered: May 2013
Distribution: Cent OS 6
Posts: 32

Rep: Reputation: Disabled
Old 05-15-2013, 09:51 AM   #3
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,605
Blog Entries: 12

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
That's a good reference, a bit informative, but it doesn't show examples where someone would perform an
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

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:
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, 12:45 AM   #4
Senior Member
Registered: Apr 2010
Posts: 1,311

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


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 05:47 AM
[SOLVED] Lack basic understanding of permissions(apache permissions problem) cK` Linux - Newbie 7 04-08-2010 11:49 PM
Understanding file permissions issue Laserjock Linux - Newbie 2 05-11-2009 11:03 AM
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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration