Find the answer to your Linux question:
Results 1 to 4 of 4
Hi I wanted to know to how to change the file permissions with chmod options...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    1

    file permissions


    Hi
    I wanted to know to how to change the file permissions with
    chmod options

  2. #2
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    The Hot Humid South
    Posts
    602
    Type "man chmod" in the command line. CHMOD is pretty easy to use!

  3. #3
    Just Joined! jojojo's Avatar
    Join Date
    May 2005
    Location
    Kuala Lumpur, Malaysia
    Posts
    99
    First log in as root then you can type the permission on any file types using these command:

    Code:
    chmod 757 abc
    Permission are ste with a three number code. The first number (7) is set for the owner, second (5) is for users in owners group and third (7) is for everyone else. The abc is the name of your file.

    r=read, w=write, x=execute

    Permission = Numbers
    r = 4
    w = 2
    x = 1
    rx = 5 (4 + 1)
    rw = 6 (4 + 2)
    wx = 3 (2 + 1)
    rwx = 7 (4 + 2 + 1)

    So if u want a person to have full access of a file, type chmod 777 abc

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    Or another way is the ugo method, where u=user(owner), g=group, o=others, and a=all. You can easily change any one, two, or all three of those to any setting you like by combining (u, g, o, and/or a) + (+, -, or =) + (r, w, and/or x).
    For example:
    Code:
    # chmod a-rwx myfile
    // results in
    ---------- myfile
    /* What we've done here is taken read, write, and execute priveleges
    away from all. Note too that the a really isn't necessary; you could just
    write -rwx and it will do the same thing. */
    
    # chmod u+rw myfile
    // results in
    -rw------- myfile
    /* So we've added read/write permissions for the user (owner). */
    
    # chmod g+r
    //results in
    -rw-r----- myfile
    /* This adds read permission to people in the file's group. /*
    
    # chmod go=x
    // results in
    -rw---x--x
    /* Now group and others have execute permission. Notice that the group
    lost their read permission. When you use the = operator, it sets permissions
    to exactly what you specify in that command--nothing more, nothing less.
    The + operator, on the other hand, adds a permission to what's already there. */
    This was the first way I learned, and I think it's easier to remember. The numbers method comes in handy for things like shell scripts and understanding umask. Both work equally well, so just use the power of choice that Linux gives you!
    Stand up and be counted as a Linux user!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •