Re: Perl GKT gksu



On Tue, 2006-03-21 at 21:44 -0400, Josà Luis Regalado wrote:
greetings.
Sorry for my English.

I need write a program for administration. I need work with *gksu*

I not know about how work perl scripts and gtk with gksu.  Please i need 
how to.

If you had a compiled C program like 'xclock' you could run it via gksu
like this:

  gksu xclock

If you had a Perl+GTK program called for example 'setclock' then you
would run it via gksu in exactly the same way:

  gksu setclock

I just tested that now and had no problem.  I would recommend two
things:

1. Make sure your Perl program enables 'taint' checking by turning on
   the -T option.  The first line of the Perl program should be similar
   to this:

   #!/usr/bin/perl -T

   This will protect you against common attacks using malicious
   characters in command line arguments, environment variables, etc.

2. Don't use gksu, use gksudo instead.  The first requires the user to
   know the root password whereas the second only requires them to know
   their own password.  With the root password they can do anything.  
   With sudo and their own password they can do only what you let them
   do.

In general, gksudo should work with graphical applications too, but I
have found in necessary to tweak the sudoers file to pass the required
DISPLAY and XAUTHORITY environment variables (particularly on Debian):

  User_Alias  X_USERS = tom, dick, larry

  Defaults:X_USERS env_reset
  Defaults:X_USERS env_keep += DISPLAY
  Defaults:X_USERS env_keep += XAUTHORITY

Regards
Grant




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]