I know this post is nearly 6 months old but nobody has suggested using the yad (yet another dialogue) tool. This is how it looks:
The full command is:
password="$(yad --center --width=300 --image=keys.png --entry --hide-text --button=gtk-ok:0 --button=gtk-cancel:1 --title="Authentication required" --text="Enter password:")"
The password is not displayed on the screen as it is entered (the "--hide-text" does that). The buttons are the standard gtk "OK" and "Cancel" ones. In this example the password that was entered can be accessed from the variable $password, e.g.
echo $password
If the cancel button is pressed the return code ($?) from yad is 1 (from --button=gtk-cancel:1) and the return code is 0 when the OK button is pressed (from --button=gtk-ok:0).
yad can be intalled in later Ubuntu versions from the Software Centre, 16.04 requires installation using:
sudo apt install yad
The home page for yad is here:
https://sourceforge.net/projects/yad-dialog/
Other examples showing how to use yad can be found here:
https://sourceforge.net/p/yad-dialog/wiki/browse_pages/
pkexec
(polkit)