Results 1 to 9 of 9

Thread: Symbolic vs Absolute

  1. #1
    Join Date
    Aug 2024
    Beans
    11

    Symbolic vs Absolute

    Hello forum,

    I am currently learning how to use the chmod command, now my question would be, when using the Symbolic Mode is there a way to set permissions separately like you do with the Absolute mode?

    e.g.
    Code:
    sudo chmod 777 filename
    With this I am granting rights individually to all; user, group and others but I don't know how to do the same with the Symbolic mode, lets just say I want to give rwx rights to the group but at the same time I want to revoke all rights for others.

    I know I can do the following but I'm not sure if I would need to run the command a second time to achieve what I am trying to do.
    Code:
    chmod go +wrx filename
    Last edited by jmkmx; September 4th, 2024 at 08:42 PM.

  2. #2
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,847

    Re: Symbolic vs Absolute

    You can do it all in one command
    Code:
    :
    chmod g+rwx,o-rwx filename
    You can also use = to set permissions:
    Code:
    chmod g=rw,o=r filename
    with = any permission not specified is removed if present. So g loses x, and o loses w and x
    Last edited by Dennis N; September 4th, 2024 at 10:42 PM.

  3. #3
    Join Date
    Aug 2024
    Beans
    11

    Re: Symbolic vs Absolute

    Awesome, I appreciate the extra tip right at the bottom... Thank you very much my friend!
    Last edited by jmkmx; September 5th, 2024 at 03:01 PM.

  4. #4
    Join Date
    May 2010
    Beans
    3,445

    Re: Symbolic vs Absolute

    Please mark as solved if the issue is sorted, or add more detail and we can assist more

  5. #5
    Join Date
    Aug 2024
    Beans
    11

    Re: Symbolic vs Absolute

    Sorry, I had no idea this was a thing, it is done now, I have another post, let me go mark it as resolved as well...

  6. #6
    Join Date
    Aug 2024
    Beans
    11

    Re: Symbolic vs Absolute

    I have one more question regarding the same subject...

    When removing the SUID or GUID in symbolic mode I would do the following:
    Code:
    sudo chmod ug-s filename
    But when I try to do the same while using the absolute mode, only the SUID gets removed for some reason while GUID stays in place.

    e.g.
    Code:
    sudo chmod 0755 filename
    What would be the proper command to remove the GPUI or both of them at the same time in the absolute mode?

  7. #7
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,847

    Re: Symbolic vs Absolute

    What would be the proper command to remove the GPUI or both of them at the same time in the absolute mode?
    Here's an example, setting and unsetting:

    Code:
    Original file:
    
    [dmn@Tyana testing]$ ls -l
    total 0
    -rw-r--r-- 1 dmn dmn 0 Sep  6 13:45 myfile.txt
    
    Set SUID and GUID:
    [dmn@Tyana testing]$ chmod 6644 myfile.txt
    [dmn@Tyana testing]$ ls -l
    total 0
    -rwSr-Sr-- 1 dmn dmn 0 Sep  6 13:45 myfile.txt
    
    reverse it:
    [dmn@Tyana testing]$ chmod 644 myfile.txt
    [dmn@Tyana testing]$ ls -l
    total 0
    -rw-r--r-- 1 dmn dmn 0 Sep  6 13:45 myfile.txt
    
    as it originally was.

  8. #8
    Join Date
    Aug 2024
    Beans
    11

    Re: Symbolic vs Absolute

    Ah I see, you don't really need to specify, just set the original values, interesting, once again thank you very much!

  9. #9
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,847

    Re: Symbolic vs Absolute

    Quote Originally Posted by jmkmx View Post
    Ah I see, you don't really need to specify, just set the original values, interesting, once again thank you very much!
    You got it. This is an advantage of the 'absolute' (numerical) notation. No adding or subtracting involved.

Bookmarks

Posting Permissions

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