Exemplo n.º 1
0
/usr/sbin/sudopw (assuming that is where this script is installed), and
call sudo with the -A option.

For example:
export SUDO_ASKPASS=/usr/sbin/sudopw
sudo -A env

Of course you also need to set up your /etc/sudoers file so that the
user concerned is allowed to execute the desired programs (see the man
pages for sudo and sudoers).
"""

from uipi import Uipi
import sys


def done(okpw):
    global ecode
    if okpw[0]:
        print okpw[1]
        ecode = 0
    else:
        ecode = 1


ui = Uipi()
ui.addslot("done", done)
okpw = ui.textLineDialog(sys.argv[1], "sudopw", async="done", pw=True)
ui.mainloop()
exit(ecode)