Modify webinterface password change command

At the moment the command to change a forgotten password is "sudo pihole -a -p newpassword" which leads to 2 problems.

  1. "newpassword" can be seen on commandline while typing (also for people standing behind you while typing, not just you)

  2. inexperienced users can't set a password with special characters if they don't know that they need to escape them on bash (example: for setting "P!Hole" as a password you have to type "sudo pihole -a -p P\!Hole")

Preferred solution: handle passwort change command like "passwd" normally does.
Shurely both issues are kind of low priority but if you got some extra free time you could think about it :slight_smile:

As a temp thing, put this in your "~/.profile" file:

alias piholepass='sudo pihole -a -p $(whiptail --title "Pi-Hole" --passwordbox "Password" 7 30 3>&1 1>&2 2>&3)'

Activate without rebooting by running:

source ~/.profile

And use "piholepass" command/alias to enter password (or leave empty) without being displayed on screen.

1 Like

Also in the meantime, you can erase the command from the history:

history -d $((HISTCMD-1)) && sudo pihole -a -p password
1 Like

v3.2 allows you to enter a password hidden from history:

pihole@pihole:~# pihole -a -p
Enter New Password (Blank for no password): 
Confirm Password: 
  [✓] New password set
root@pihole:~# 
1 Like