File Permissions

    Date11 Jul 2000
    13181
    Posted ByAnthony Pell
    Linux/Unix allows users to protect their data from access by other users.

    Introduction

    File permissions are usually confusing to newer Linux users. Most 'newbies' are not accustom to implementing file security because of thier DOS/Windows background. Why do we need file security? It is primarly needed to ensure data protection and privacy from other system users. In other cases, file security is needed to prevent 'normal users' (as opposed to system administrators) from changing configurations or accidently damaging a system. File permissions allow users to share selected data and programs with other users by the means of a simple but effective protection scheme.

    Q. How do you know what permissions are granted for a particular file?

    A. Use the command: ls -l
    The first 10 characters displayed are the file type and access permissions: -rwxrwxr-x or drwxrwxr-x.

    • The first character is either - or d. A dash indicates that it is a file and a indicates that it is a directory.
    • The next 3 characters show the owner's permissions.
    • The following 3 indicate the permissions for users in the file's group.
    • The last 3 characters show the permissions for all other users.

    The possibilities for permissions include:

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

    Q. How do I change permissions for a particular file that I own?

    A. Use the 'chmod' utility. Syntax:chmod who [operation] [permission] file(s)

    Who:
    -------------
    u - user/owner
    g - group
    o - other users
    a - all users

    Operation:
    -------------
    + add permission
    - remove permission

    Permission:
    -------------
    r - read
    w - write
    x - execute

    File(s):
    ------------
    List 1 or more filenames.

    Examples of using 'chmod' to change permissions:

    % chmod a+r /home/usr/abd01/data
    This gives everyone on the system permission to read 'data'

    % chmod og=, u+rwx /home/usr/abd01/protect
    This takes away rwx permission from group members and all other users on the system. It also adds rwx permissions for the file owner.

    Note: chmod can also be used with an octal absolute system. This method is described in another tip. ( i.e. chmod 755 filename ).

    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":"5","type":"x","order":"1","pct":55.56,"resources":[]},{"id":"88","title":"Should be more technical","votes":"3","type":"x","order":"2","pct":33.33,"resources":[]},{"id":"89","title":"Should include more HOWTOs","votes":"1","type":"x","order":"3","pct":11.11,"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.