Getting to Know Linux Security: File Permissions

    Date03 Feb 2005
    CategoryFeatures
    89274
    Posted ByBenjamin D. Thomas
    Welcome to the first tutorial in the 'Getting to Know Linux Security' series. The topic explored is Linux file permissions. It offers an easy to follow explanation of how to read permissions, and how to set them using chmod. This guide is intended for users new to Linux security, therefore very simple. If the feedback is good, I'll consider creating more complex guides for advanced users. Please let us know what you think and how these can be improved. If you have ideas for future topics, please post them in the discussion forum below.

    Click image to begin tutorial.
    Demo Icon

    Script

    Hello, my name is Benjamin Thomas and I am with Guardian Digital, Inc, the primary sponsor of LinuxSecurity.com Welcome to the first of the "Getting to know Linux Security" series tutorials that will be featured on our site. Today's topic is file permissions. This lesson is primarly intended for those users who are just getting started, and other wishing to brush up old skills. The examples I show you today are from a typical Linux command line. Today, I'll be using EnGarde Secure Linux. More information about this distribution can be found at Guardian Digital.com and it can be downloaded at EnGardeLinux.org.

    ...

    Lets Begin. To see a listing of files in a directory, execute the command 'ls'. As you'll see, there are no files in the temporary directory that I'm using. Let's first create several files.

    touch file1 file2 file3

    The command 'ls' then shows the files we have created. A more informative way to show the files is ls -la. The 'l' switch lists files in long format, and the 'a' switch lists all files, including hidden ones.

    ...

    Lets look at file1 (select line) The first field reprents the file's type. For regular files this is always a dash, for directories, it will be reprented as a d. (There are other's, but beyond the scope of this lesson) The next nine represent the file's permission. The the number of 'hard' links to the file, the file owner's username, the owner's group, the file's size, its modification date and time, and the file's name.

    ...

    Lets examine the permission field closer. The first three blocks represents the access granted to the file's owner. The next three, represent access granted to other group members, and the last three represent everyone else's level of access. The possibilities for permissions include:

    r - read
    w - write
    x - execute
    - - no permission

    ...

    If you are the owner of a file, you have the ability to change its permissions with the chmod command. There are several ways chmod can be used, however in today's lesson I will only focus on the octal system. The first number represents the owner's permission, the 2nd represents the groups permission, and the last one' represents the world's or everyone's access. The permission is calculated using simple arimetic. 1 is for exectute permission 2 is for write permission 4 is for read permission

    The permission is set using the chmod command:

    chmod 755 file1

    You may asking, but what does 755 mean? 7 comes from 1 + 2 + 4. 5 comes from 1 + 4. This means that the file's owner has read, write, and execute permission, but group and world only have read and execute.

    ...

    Overtime you'll find that this method of setting permissions becomes natural. After getting comfortable with this method you'll find that Linux permisssion aren't difficult at all to understand.

    ...

    Once again, thank you for visiting LinuxSecurity.com. I hope you have found this guide helpful and you are looking forward to other tutorials in the Getting to know Linux Security series. Please do no hesitate to send comments, questions, or ideas to me at the following email address: This email address is being protected from spambots. You need JavaScript enabled to view it.

    ...

    This guide has been sponsored by Guardian Digital, creators of EnGarde Secure Linux. www.guardiandigital.com

    You are not authorised to post comments.

    Comments powered by CComment

    LinuxSecurity Poll

    What do you think of the articles on LinuxSecurity?

    No answer selected. Please try again.
    Please select either existing option or enter your own, however not both.
    Please select minimum 0 answer(s) and maximum 3 answer(s).
    /main-polls/24-what-do-you-think-of-the-quality-of-the-articles-on-linuxsecurity?task=poll.vote&format=json
    24
    radio
    [{"id":"87","title":"Excellent, don't change a thing!","votes":"65","type":"x","order":"1","pct":57.52,"resources":[]},{"id":"88","title":"Should be more technical","votes":"15","type":"x","order":"2","pct":13.27,"resources":[]},{"id":"89","title":"Should include more HOWTOs","votes":"33","type":"x","order":"3","pct":29.2,"resources":[]}]["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"]["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"]350
    bottom200

    We use cookies to provide and improve our services. By using our site, you consent to our Cookie Policy.