[sudo-users] Using sudo from a GUI app (getting a persistent ticket)
Todd C. Miller
Todd.Miller at courtesan.com
Fri Sep 27 09:12:45 MDT 2013
When you have tty_tickets enabled you must have a tty in order to
have a timestamp file. No tty means no timestamp file. For GUI
programs and non-interactive ssh sessions without the -tt flag there
is no tty and hence no timestamp file is used.
Starting with version 1.8.8 (to be released Monday), sudo will use
a timestamp file based on the parent process ID when no tty is
available. This provides equivalent functionality when you don't
have a tty.
For older versions of sudo you will need to allocate a pty via
posix_openpt() and friends and run the command with the pty slave
device as the controlling terminal. Yes, this is a pain. Alternately,
your application could prompt for the user's password and keep it
in memory, providing it to sudo each time.
More information about the sudo-users