how do i set askpass variable?

Solution 1:

WARNING! "could be upper case or lower case" is incorrect. Unix/Linux is case sensitive, which means that SUDO_ASKPASS and sudo_askpass are different.
WARNING! "set in an environment variable or done in sudoers" is incorrect. You can set the environment variable SUDO_ASKPASS or modify /etc/sudo.conf.

From man sudo:

 -A, --askpass
             Normally, if sudo requires a password, it will read it from the user's terminal.
             If the -A (askpass) option is specified, a (possibly graphical) helper program
             is executed to read the user's password and output the password to the standard
             output.  If the SUDO_ASKPASS environment variable is set, it specifies the path
             to the helper program.  Otherwise, if sudo.conf(5) contains a line specifying
             the askpass program, that value will be used.  For example:

                 # Path to askpass helper program
                 Path askpass /usr/X11R6/bin/ssh-askpass

             If no askpass program is available, sudo will exit with an error.

Also, from man sudo.conf,

 The following plugin-agnostic paths may be set in the /etc/sudo.conf file:

 askpass   The fully qualified path to a helper program used to read the user's password when
           no terminal is available.  This may be the case when sudo is executed from a
           graphical (as opposed to text-based) application.  The program specified by
           askpass should display the argument passed to it as the prompt and write the
           user's password to the standard output.  The value of askpass may be overridden by
           the SUDO_ASKPASS environment variable.

So, you could add the following line to your ~/.bashrc:

export SUDO_ASKPASS=/usr/X11R6/bin/ssh-askpass  

You could try it for one command,

SUDO_ASKPASS=/usr/X11R6/bin/ssh-askpass sudo -A id

OR, you could uncomment (remove the initial "#") on the appropriate line of sudo.conf (see /usr/share/doc/sudo/examples/sudo.conf)

#
# Sudo askpass:
#
# An askpass helper program may be specified to provide a graphical
# password prompt for "sudo -A" support.  Sudo does not ship with its
# own askpass program but can use the OpenSSH askpass.
#
# Use the OpenSSH askpass
#Path askpass /usr/X11R6/bin/ssh-askpass
#
# Use the Gnome OpenSSH askpass
#Path askpass /usr/libexec/openssh/gnome-ssh-askpass

#
# Sudo askpass:
#
# An askpass helper program may be specified to provide a graphical
# password prompt for "sudo -A" support.  Sudo does not ship with its
# own askpass program but can use the OpenSSH askpass.
#
# Use the OpenSSH askpass
#Path askpass /usr/X11R6/bin/ssh-askpass
#
# Use the Gnome OpenSSH askpass
#Path askpass /usr/libexec/openssh/gnome-ssh-askpass

Solution 2:

If somebody using Lubuntu 20.04 should stumble on this, you use:

/usr/bin/ssh-askpass