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



Thanks Stefano;

It now works.

On Sat, 2006-12-02 at 20:16 +0100, Stefano Sabatini wrote:
Hi William.

On Friday 2006-12-01 11:15:33 -0500, William Case wrote:
Tried:

Nothing shows up on my desktop.

How did you try it?

Wrote it as a script in a file called RootBrowser. Changed the
permissions to executable by bill (as usual). I have bill's PATH
including $HOME/.gnome2/nautilus-scripts. Tried .RootBrowser from the
command line. It worked but gave me the last two lines as returns for
the gterm.

Tried it as a single command line. It worked as above.
If you wrote it in a file and then launched it
get sure to put in the first line
#! /usr/bin/bash
I did that.

and to change permission of the file (it has to be executable at least
by you).

I did that.
I'm trying this script and it works both as a script launched from
gnome-terminal and when it's called by a gnome-panel launcher:

#! /bin/bash

# this forces the password typing, even in the case the sudo timeout has
# not yet expired
sudo -k
Didn't use sudo -k but it makes sense as a precaution

zenity --entry --title="Browse files as root" --text="Enter your password:" --hide-text \
| sudo -S nautilus --no-desktop --browser 1> /dev/null 2> /dev/null

Knew I probably wanted to background or /dev/null return variabless 1 &
2 above but wasn't sure how to go about it. Had read some manuals about
file descriptors but have never need to use them, so didn't know how to
use 1 & 2 to send the lines /dev/null. Tried things that were far too
complex that obviously didn't work. So, thanks that was the solution I
needed.

if [ "$?" != 0 ]; then
zenity --error --text="Sorry, bad password"
return 1
fi
Essentially did that. Knew to do it but hadn't written it yet trying to
keep the number of possible complications down until the rest worked.


What do I do with these two lines?

Anything you want to do with them ;-). If you don't like this output
you can simply send it to /dev/null (as in the above script). sudo
prints the "password:" prompt on stderr (file descriptor number 2),
nautilus writes on both stderr and stdin (file descriptor number
1). If you are running the script through a launcher the output will
be happily ignored.

Thanks for the explanation. I'll go back and 'man' for your kind of
comments if I have further questions.

HTH

Ciao!
_______________________________________________
gnome-list mailing list
gnome-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gnome-list
--
Regards Bill

_______________________________________________
gnome-list mailing list
gnome-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gnome-list



Relevant Pages

  • Re: Gruppo di =?ISO-8859-1?Q?continuit=E0eutenteRoot?=
    ... No, non va modificato lo script, si tratta di scrivere sudo davanti allo ... leggendo poi tra le varie FAQ e sul forum avevo trovato una procedura ... Non funziona male ma e proprietario, con tutti i difetti che questo ...
    (it.comp.macintosh)
  • Re: [opensuse] saving boot-time console output
    ... # Set I/O of this script and its childs to console ... not specify a file descriptor open for input, ... a redirection error occurs. ... standard output is used. ...
    (SuSE)
  • Re: How to suspend x86 via apm as non-root user?
    ... Use sudo, combined with a script that runs apm -s. ... USERS ALL = NOPASSWD: SHUTDOWN, NTPDATE ...
    (Debian-User)
  • Re: Solaris 10 - catman weird error
    ... DTrace can absolutely help in this situation. ... returns EIO or EBADF: ... probably want to know _how_ exactly the file descriptor was closed. ... that you know the process ID of the problematic process, here is a D script ...
    (comp.unix.solaris)
  • Re: Card Reader
    ... Running your script ... instead of sudo is worthless because your script *can't do ... And of course it doesn't ask for a root password, ... >> That's just more bullshit Bryan, and you might as well leave ...
    (rec.photo.digital)