[ILUG] UserA <--> UserB Interaction

Brian Foster blf at utvinternet.ie
Mon Feb 4 19:58:01 GMT 2008


  | Date: Mon, 04 Feb 2008 08:54:34 +0100
  | From: Paolo Marchiori <paolo at marchiori.net>
  | 
  | Brian Foster wrote:
  |  >  modify ‘sux’ to use sudo(1) rather than su(1), and to
  |  > [...] (e.g., “sudo -u USER -b boincmgr ...”) — or perhaps
  | 
  | exec "sudo -u USER sux -c xthis"

 NO.  even without trying that, that's very very
 obviously wrong:

 1. think about the syntax for a second:

        exec "sudo -u USER sux -c 'xthis ...'"

    (note the added missing '-quotes, need because
    <xthis> has some arguments <...>).  that will
    clearly result in an error, similar to:

        bash: exec: xthis ...: not found

 2. correcting by elimating the "-quotes (and also
    elimating the ‘exec’ since it is not germaine):

        sudo -u USER sux -c 'xthis ...'

    still won't work.  the sudo(1)'ed command won't
    have access to the X11 display, which is the
    basic problem we're trying to solve here!

     the fact the ‘sudo’ed command is sux(1) does not
    matter.  the ‘sudo’ing looses access to the X11
    display.  the ‘sux’ is then actually pointless.
    and it is also silly, since no user is specified,
    hence the ‘sux’ will try to ‘su’ to the superuser
    (“root”), which (in this case) is un-necessary.

 a test of a corrected command line (also using the
 wanted ‘sudo’ ‘-b’ option) shows the predications
 to be correct:

     $ sudo -u USER -b sux -c 'xthis ...' USER
     Password: [type in USER's password]
     $ /usr/X11R6/bin/sux: line 143: /home/blf/.Xauthority: Permission denied
     cat: /home/blf/.Xauthority: Permission denied
     Password: [‘su’ run by backgrounded sux(1) reads /dev/null]
     su: incorrect password

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