[ILUG] chmod a+rX -r /etc/xdg/menus

Brian Foster blf at utvinternet.ie
Tue Jan 29 22:03:00 GMT 2008


  | Date: Tue, 29 Jan 2008 08:39:29 +0000
  | From: Frank Murphy <frankly3d.ilug at gmail.com>
  | 
  | Fedora-8-xfce
  | 
  | root at fedora8 ~]# chmod a+rX -r /etc/xdg/menus
  | chmod: cannot access `a+rX': No such file or directory
  | 
  | /etc/xdg/menus  does exist.
  | 
  | Where am I going wrong

 as others have noted, chmod(1) does not have a -r option.
 whilst that's pedantically correct, it's not quite right.
 normally, on an non-existent option like -r, you'd expect
 an error something like:

     chmod: invalid option -- r
     Try `chmod --help' for more information.

 so why the rather mysterious complaint that a+rX does not
 exist?

 well .... because -r *IS* a legal mode setting to chmod;
 in particular, it means a-r (i.e., remove read permission
 for everyone).  because it starts with - the command line
 is rearranged (probably by GNU getopt_long(3)) so that it
 is the first arg:

     chmod -r a+rX /etc/xdg/menus

 the missing a is then supplied:

     chmod a-r a+rX /etc/xdg/menus

 now chmod attempts to remove read permission for everyone
 from all the listed files, starting with the "file" a+rX.
 there is no such file, hence the error ....

 and it did remove all read permissions from /etc/xdg/menus
 (in case you hadn't noticed).

cheers!
	-blf-
-- 
“How many surrealists does it take to    |  Brian Foster
 change a lightbulb?  Three.  One calms  |  somewhere in south of France
 the warthog, and two fill the bathtub   |     Stop E$$o (ExxonMobile)!
 with brightly-coloured machine tools.”  |       http://www.stopesso.com



More information about the ILUG mailing list