[SOLVED] Zenmap (as root) & gksu -u

You think you have found a bug? Let us know about it.
Post Reply
User avatar
laprjns
Salix Warrior
Posts: 1113
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

[SOLVED] Zenmap (as root) & gksu -u

Post by laprjns »

Trying to launch "Zenmap (as root)" from the menu results in nothing visually happening. Running this down, the desktop application file tries running the script /usr/share/zenmap/su-to-zenmap.sh. This script determines the appropriate graphical front end for su and uses it to launch zenmap with root permissions. Apparently this script determines that gksu is the appropriate front end on my XFCE system and then tries executing:

Code: Select all

gksu -u "$PRIV" "$COMMAND"
with $PRIV = "root" and $COMMAND = "zenmap". However the -u option does not seem to be valid and results in an error.
Once I changed the above line in the script to

Code: Select all

gksu "$COMMAND"
it worked.
All the on line man pages seems to suggest that the -u option is supported but it does not work here. Here's the entire script including my modification, for reference:

Code: Select all

#!/bin/bash
#this code is bassed off of the debian su-to-root command
#Joost Witteveen <joostje@debian.org>
#Morten Brix Pedersen
#Bill Allombert <ballombe@debian.org>

PRIV=root
COMMAND="zenmap $@"

euid=$(id -u)
privid=$(id -u $PRIV)
if test "$euid" = "$privid"; then
    $COMMAND
else
    if test -z "$SU_TO_ROOT_X"; then
      if which gksu >/dev/null 2>&1 ; then
        SU_TO_ROOT_X=gksu
        if test "X$KDE_FULL_SESSION" = "Xtrue" ; then
          if which kdesu >/dev/null 2>&1 ; then
            SU_TO_ROOT_X=kdesu
          elif test -x /usr/lib/kde4/libexec/kdesu ; then
            SU_TO_ROOT_X=kde4su
          fi;
        fi;
      elif which kdesu >/dev/null 2>&1 ; then 
        SU_TO_ROOT_X=kdesu
      elif test -x /usr/lib/kde4/libexec/kdesu ; then
        SU_TO_ROOT_X=kde4su
      elif which ktsuss >/dev/null 2>&1 ; then
        SU_TO_ROOT_X=ktsuss
      elif which xterm>/dev/null 2>&1 ;then
        if which sudo>/dev/null 2>&1 ;then
          SU_TO_ROOT_X=sdterm
        else
          SU_TO_ROOT_X=sterm
        fi;
      else
        SU_TO_ROOT_X=su-to-root
      fi
    fi
    case $SU_TO_ROOT_X in
   #  gksu) gksu -u "$PRIV" "$COMMAND";;
	  gksu) gksu "$COMMAND";;
      kdesu) kdesu -u "$PRIV" "$COMMAND";;
      kde4su) /usr/lib/kde4/libexec/kdesu -u "$PRIV" "$COMMAND";;
      ktsuss) ktsuss -u "$PRIV" "$COMMAND";;
  # As a last resort, open a new xterm use sudo/su
      sdterm) xterm -e "sudo -u $PRIV $COMMAND";;
      sterm) xterm -e "su -l $PRIV -c $COMMAND";;
    esac;
fi
Thanks
Rich
“The past was erased, the erasure was forgotten, the lie became the truth.”
― George Orwell, 1984
User avatar
pwatk
Posts: 474
Joined: 14. Mar 2010, 23:56
Location: United Kingdom

Re: Zenmap (as root) & gksu -u

Post by pwatk »

gksu isn't actually installed, it's just a script I wrote for launching ktsuss:

Code: Select all

#!/bin/sh
# /usr/bin/gksu

PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin"
CMD="$@"
BIN="$1"

if [ -x "`type -path ktsuss`" ]; then
  KTSUSS="`type -path ktsuss` -u root"
else
  echo "$(basename $0): \`ktsuss' command not found"
  exit 1
fi

if [ "$UID" = "0" ]; then
  KTSUSS=""
fi

if [ -x "`type -path $BIN`" ]; then
  eval "$KTSUSS" "$CMD"
else
  echo "$(basename $0): \`$BIN' command not found"
  exit 1
fi
I'm busy with a few other things at the moment but I'll try to write in a -u option and post it to the bugtracker in the next few days
Image
User avatar
pwatk
Posts: 474
Joined: 14. Mar 2010, 23:56
Location: United Kingdom

Re: Zenmap (as root) & gksu -u

Post by pwatk »

Image
User avatar
gapan
Salix Wizard
Posts: 6361
Joined: 6. Jun 2009, 17:40

Re: [SOLVED] Zenmap (as root) & gksu -u

Post by gapan »

Thanks pwatk. :)
Image
Image
User avatar
pwatk
Posts: 474
Joined: 14. Mar 2010, 23:56
Location: United Kingdom

Re: [SOLVED] Zenmap (as root) & gksu -u

Post by pwatk »

I just couldn't leave it alone :) .
Image
User avatar
laprjns
Salix Warrior
Posts: 1113
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: [SOLVED] Zenmap (as root) & gksu -u

Post by laprjns »

Thank you. I'll give it a try when I get back from my business trip. I assume that it will be avaialble as an upgrade (slapt-get --upg).
“The past was erased, the erasure was forgotten, the lie became the truth.”
― George Orwell, 1984
User avatar
gapan
Salix Wizard
Posts: 6361
Joined: 6. Jun 2009, 17:40

Re: [SOLVED] Zenmap (as root) & gksu -u

Post by gapan »

It is already.
Image
Image
Post Reply