securitybreach Posted February 15, 2016 Share Posted February 15, 2016 Figure 1: Permission listing of files within ~/. One of the most basic tasks in Linux is setting file permissions. Understanding how this is done should be considered a must-know, first step in your travels through the Linux ecosystem. As you might expect, such a fundamental issue within the operating environment hasn’t changed much over the years. In fact, the Linux file permission system is taken directly from the UNIX file permission (and even uses many of the same tools). But, don’t think for a second that understanding file permissions is something you’ll wind up having to spend days and days studying...it’s actually quite simple. Let’s walk through what you need to know and how to put it all together. The Bits and Pieces The first thing you need to understand is what file permissions apply to. Effectively what you do is apply a permission to a group. When you break it down, the concept really is that simple. But what are the permissions and what are the groups? There are three types of permissions you can apply: read — gives the group permission to read the file (indicated with r) write — gives the group permission to edit the file (indicated with w) execute — gives the group permission to execute (run) the file (indicated with x) To better explain how this is applied to a group, you could, for example, give a group permission to read and write to a file, but not execute the file. Or, you could give a group permission to read and execute a file, but not write to a file. You can even give a group full permission to read, write, and execute a file or strip a group of any access to a file by removing all permissions. Now, what are the groups? There are four: user — the actual owner of the file group — users in the file’s group others — other users not in the file’s group all — all users For the most part, you will only really ever bother with the first three groups. The all group is really only used as a shortcut (I’ll explain later). So far so simple, right? Let’s layer on a bit of complexity. If you open up a terminal window and issue the command ls -l, you will see a line-by-line listing of all files and folders within the current working directory (Figure 1 above). If you look in the far left column, you’ll notice listings like -rw-rw-r--. That listing should actually be looked at like so: rw- rw- r-- As you can see, the listing is broken into three sections: rw- rw- r-- The order is quite important...for both permissions and for groups. The order is always: User Group Others — for groups Read Write Execute — for permissions In our permissions listing example above, the User has read/write permission, the Group has read/write permission, and Others has only read permission. Had any of those groups been given executable permissions, it would have been represented with an x.... http://www.linux.com...ile-permissions 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.