Skip to content

Commit b6b4a05

Browse files
committed
whiptail for passwords
1 parent a80cfb8 commit b6b4a05

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

iiab-upgrade

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,13 @@ fi
149149

150150
# B. Ask for password change if pi/raspberry default remains
151151
if check_user_pwd "pi" "raspberry"; then
152-
echo -e "\n\nRaspberry Pi's are COMPROMISED often if the default password is not changed!\n"
153-
echo -n "What password do you want for GNU/Linux user 'pi' ? "
154-
read -t 5 ans < /dev/tty # Whines but doesn't change password if [Enter]
155-
echo pi:"$ans" | chpasswd || true # Overrides 'set -e'
152+
if [ $INTERACTIVE == 1 ]; then
153+
PASSWORD=$(whiptail --passwordbox "
154+
Raspberry Pi's are COMPROMISED often if the default password is not changed!
155+
What password do you want for GNU/Linux user 'pi' ?
156+
press [Enter] for no change " 12 78 --title "password dialog" 3>&1 1>&2 2>&3)
157+
echo pi:$PASSWORD | chpasswd 2>&1 > /dev/null || true # Overrides 'set -e'
158+
fi
156159
fi
157160

158161
# C. Create user 'iiab-admin' as nec, with default password
@@ -163,14 +166,13 @@ fi
163166

164167
# D. Ask for password change if iiab-admin/g0adm1n default remains
165168
if check_user_pwd "iiab-admin" "g0adm1n"; then
166-
echo -e "\n\nUser 'iiab-admin' retains default password 'g0adm1n' per http://FAQ.IIAB.IO\n"
167-
168-
echo -e "This is for login to Internet-in-a-Box's Admin Console (http://box.lan/admin)\n"
169169
if [ $INTERACTIVE == 1 ]; then
170-
echo -n "What password do you want for GNU/Linux user 'iiab-admin' ? "
171-
echo -n "press [Enter] for no change"
172-
read -t 15 ans < /dev/tty # Whines but doesn't change password if [Enter]
173-
echo iiab-admin:"$ans" | chpasswd || true # Overrides 'set -e'
170+
PASSWORD2=$(whiptail --passwordbox "
171+
User 'iiab-admin' retains default password 'g0adm1n' per http://FAQ.IIAB.IO
172+
This is for login to Internet-in-a-Box's Admin Console (http://box.lan/admin)
173+
What password do you want for GNU/Linux user 'iiab-admin' ?
174+
press [Enter] for no change " 12 78 --title "password dialog" 3>&1 1>&2 2>&3)
175+
echo iiab-admin:$PASSWORD2 | chpasswd 2>&1 > /dev/null || true # Overrides 'set -e'
174176
fi
175177
fi
176178

0 commit comments

Comments
 (0)