problems setting permissions from terminal

Discussion in 'Windows, Linux & Others on the Mac' started by cuestakid, Jul 26, 2016.

  1. cuestakid macrumors 68000

    Joined:
    Jun 14, 2006
    Location:
    San Fran
    #1
    drwxrwxrwx 10 user staff 340 Jul 12 21:49 .

    drwxrwxrwx 4 user staff 136 Jul 12 21:49 ..

    -rw-rw-rw- 1 user staff 6148 Feb 6 2011 .DS_Store

    -r-xr--r-- 1 user staff 36232 Feb 5 2011 lorem_ipsum.txt

    -rw-rw-rw- 1 user staff 55 Feb 5 2011 new_file.txt

    -rw-rw-rw- 1 user staff 81 Feb 5 2011 newer_file.txt

    -rw-rw-rw- 1 user staff 17 Feb 5 2011 overwrite_test2.txt

    -r-xr-xr-x 1 user staff 0 Feb 10 2011 ownership.txt

    -rw-rw-rw- 1 user staff 81 Feb 5 2011 short_file.txt

    drwxrwxrwx 3 user staff 102 Feb 5 2011 test1


    I am starting to learn some basics of using the Terminal /Unix and I am stuck on one particular thing. I understand that chmod is used to change permissions on different files and folders and that the syntax is "chmod mode filename". I have been able to mostly do what I want but for some reason on this lorem_ipsum.txt I cannot remove the execute (x) right from the group. I can add and remove others (R and W) but the execute command I cannot do anything with. other files (ownership.txt) seem to have a similar issue. However, other files such as new_file.txt I can move things as I want.

    All files and folders are in my home directory



    any ideas are welcome

    Thanks
    --- Post Merged, Jul 26, 2016 ---
    so I was finally able to do it but I had to do the following

    chmod =rw lorem_ipsum.txt

    This alone does not make sense since I didnt specify a mode to change, only the permission.

    What am i missing?
     
  2. MC6800 macrumors 6502

    Joined:
    Jun 29, 2016
    #2
    I would do:

    chmod a-x lorem_ipsum.txt

    That "all minus x" removes all execute permissions from the file.
     
  3. cuestakid thread starter macrumors 68000

    Joined:
    Jun 14, 2006
    Location:
    San Fran
    #3
    Thanks for the tip. May I ask what the difference between
    chmod a-x lorem_ipsum.txt and

    chmod o-x lorem_ipsum.txt

    It was my understanding that these both should do the same thing so why did the a-x work and not o-x? It seems to me that in both cases I am trying to remove the execute permission from the specific file.
     
  4. MC6800 macrumors 6502

    Joined:
    Jun 29, 2016
    #4
    "chmod o-x" will remove execution permission for "others", but leave owner and group permissions alone. In other words, it will only remove the last (others) "x" if it's there. If the file is owned by you (or in your group) it would have no apparent effect. "a-x" makes it non-executable for all.
     
  5. cuestakid thread starter macrumors 68000

    Joined:
    Jun 14, 2006
    Location:
    San Fran
    #5
    Thank you-I think I am starting to get the hang of it-now to figure out how to batch change specific files in a directory
     

Share This Page