Re: Why doesn't this sudo script using zenity work??



On date Friday 2006-12-01 05:02:30 -0500, William Case wrote:
Hi;

I have tried several variations of the following script and googled for
some clues. No joy.

#! /bin/bash
# Open nautilus as root
#

sudo nautilus --no-desktop --browser
if zenity --entry \
--title="Browse files as root" \
--text="Enter your _password:" \
--entry-text "" \
--hide-text
then echo $?
else echo "No password entered"
fi

# End

sudo nautilus --no-desktop --browser works on the command line.
Why doesn't this sudo script using zenity work??

Because you need sudo to read the password passed by zenity on stdout.
So you have to do:

zenity --entry \
--title="Browse files as root" \
--text="Enter your _password:" \
--entry-text "" \
--hide-text \
| sudo -S nautilus --no-desktop --browser

then control the return code of sudo to check that the password
entered was correct.

HTH
Regards
--
Stefano Sabatini
Linux user number 337176 (see http://li.count.org)
_______________________________________________
gnome-list mailing list
gnome-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gnome-list



Relevant Pages

  • Re: Why doesnt Fedora include gksudo/gksu as a package
    ... including a rough debug) in a terminal, ... them - but it seemed to me since I've got zenity and like its cute ... Here's the script I've got now: ... The RootBrowse script won't launch from either a desktop/panel ...
    (Fedora)
  • Why doesnt this sudo script using zenity work??
    ... # Open nautilus as root ... else echo "No password entered" ... Why doesn't this sudo script using zenity work?? ...
    (GNOME)
  • Re: Why doesnt Fedora include gksudo/gksu as a package
    ... them - but it seemed to me since I've got zenity and like its cute ... in a script in Fedora. ... package things up as rpms. ...
    (Fedora)
  • RE: creating remoteuser
    ... > I m making script to automate remote server user creation, ... > able to complete the script, plz tell me where i am going wrong... ... > echo Checking for the user file ... haven't put in the sudo code as I am not a proponent of including passwords ...
    (RedHat)
  • stdin redirection for sudo.
    ... mention that sudo can read from stdin as opposed to the terminal ... the `eval' it would just echo the entire line to ... The password is saved only as long as the script is being ... it before any command that needs $EUID=0. ...
    (comp.unix.shell)