Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cuestakid

macrumors 68000
Original poster
Jun 14, 2006
1,775
44
San Fran
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
[doublepost=1469557122][/doublepost]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?
 

MC6800

macrumors 6502
Jun 29, 2016
369
126
I would do:

chmod a-x lorem_ipsum.txt

That "all minus x" removes all execute permissions from the file.
 

cuestakid

macrumors 68000
Original poster
Jun 14, 2006
1,775
44
San Fran
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.
 

MC6800

macrumors 6502
Jun 29, 2016
369
126
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.

"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.
 

cuestakid

macrumors 68000
Original poster
Jun 14, 2006
1,775
44
San Fran
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.