gksudo disable elevation persistence

Fabio A. Miranda fabio.a.miranda at gmail.com
Sat Jan 16 12:05:24 UTC 2010


On Fri, 2010-01-15 at 23:20 +0100, Nils Kassube wrote:
> Fabio A. Miranda wrote:
> > I need gksudo to always ask for password, limiting itself to elevate
> >  the just fork'ed process and that is.
> 
> You could execute the command "sudo -k" to invalidate the sudo timestamp 
> before you execute your gksudo command.

Thanks for your fast reply.

sudo -K and sudo -K seems to work in command line but the EUID / UID of
a Java application do NOT fork().

After a call to gksudo using ProcessBuilder(), the WaitFor() mnthod
returns, then, another ProcessBuilder does bash -c '/usr/bin/gksudo -k'

The command works perfect but the next ProcessBuilder() is still
elevated so it doens't do anything.

The feature of gksudo is kool, another attempt to be "user friendly" but
in other situations we do need more control over run command as root or
run them as a normal user.

If a JVM is "elevated", the System.getProperty("user.home"); will return
root's home, bcause gksudo was ran 2 minutes ago.

Can anyone please help ?

thanks,





> 
> Nils
> 


-- 
Fabio A. Miranda
Enterprise Software
http://www.grupocesa.com/





More information about the ubuntu-users mailing list