gksudo disable elevation persistence

Karl Auer kauer at biplane.com.au
Fri Jan 15 23:38:13 UTC 2010

On Fri, 2010-01-15 at 15:49 -0600, Fabio A. Miranda wrote:
> I need gksudo to always ask for password, limiting itself to elevate the
> just fork'ed process and that is.

gksudo, like sudo, "remembers" your credentials for a certain period,
typically 5 minutes. Then it "forgets" and you have to enter your
password again.

"sudo -k" is sudo's way to "forget" on command. If you run that just
before any gksudo command, gksudo will always ask for a password.

Alternatively you can set the sudo timeout - see "man sudo" and look for
"timestamp_timeout". gksudo is just a front-end to sudo, so changing
sudo's behaviour will change gksudo's behaviour.

You can set the timeout on a per user or per group basis, so if your
program is running as a particular user/group when it needs to escalate,
you can just set that particular user's/group's timeout rather than
inconvenience everyone.

If you don't control the execution environment, "sudo -k" is probably
safest. Otherwise, setting the timeout is more elegant.

Regards, K.

Karl Auer (kauer at biplane.com.au)                   +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/                  +61-428-957160 (mob)

GPG fingerprint: B386 7819 B227 2961 8301 C5A9 2EBC 754B CD97 0156
Old fingerprint: 07F3 1DF9 9D45 8BCD 7DD5 00CE 4A44 6A03 F43A 7DEF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100116/4d46492e/attachment.pgp>

More information about the ubuntu-users mailing list