summaryrefslogtreecommitdiff
path: root/scripts/standalone_root_pw_reset
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-10-27 15:59:56 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-10-27 15:59:56 -0700
commit1b0ad6073975f6a728d2fce1a266f22636f574cb (patch)
treefca04d162fbd6ec654e47dcc85200e7574595d1d /scripts/standalone_root_pw_reset
parent045cf9441d8c4bfeb178925bf140848ab251f779 (diff)
downloadvyatta-cfg-quagga-1b0ad6073975f6a728d2fce1a266f22636f574cb.tar.gz
vyatta-cfg-quagga-1b0ad6073975f6a728d2fce1a266f22636f574cb.zip
Handle config file format change in standalone reset
Corollary to earlier bugfix in install-system
Diffstat (limited to 'scripts/standalone_root_pw_reset')
-rwxr-xr-xscripts/standalone_root_pw_reset14
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset
index f08bf7d6..34113129 100755
--- a/scripts/standalone_root_pw_reset
+++ b/scripts/standalone_root_pw_reset
@@ -23,6 +23,11 @@
# The Vyatta config file:
CF=/opt/vyatta/etc/config/config.boot
+set_encrypted_password() {
+ sed -i \
+ -e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password: \"$2\"/" $3
+}
+
change_password() {
local user=$1
local pwd1="1"
@@ -30,9 +35,9 @@ change_password() {
until [ "$pwd1" == "$pwd2" ]
do
- read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 1>&0
+ read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 2>&0
echo
- read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 1>&0
+ read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 2>&0
echo
if [ "$pwd1" != "$pwd2" ]
@@ -42,10 +47,7 @@ change_password() {
# escape any slashes in resulting password
local epwd=$(mkpasswd -H md5 "$pwd1" | sed 's:/:\\/:g')
-
- sed -i \
- -e "/ user $user {/,/}/s/encrypted-password:.*\$/encrypted-password: \"$epwd\"/" \
- $CF
+ set_encrypted_password $user $epwd $CF
}
echo "Standalone root password recovery tool."