diff options
author | Rick Balocca <rbalocca@vyatta.com> | 2008-10-28 11:48:24 -0700 |
---|---|---|
committer | Rick Balocca <rbalocca@vyatta.com> | 2008-10-28 11:48:24 -0700 |
commit | 841e41f385ca960fb703ff612b014d7e57560b3e (patch) | |
tree | 1c85e6040bbce551469aaa5461bcc2c58ba32da6 /scripts/standalone_root_pw_reset | |
parent | 056c3079a791a246907a442e35063f42af5b3a99 (diff) | |
parent | 3537c028bc63e18568e70dfd3c1634d857918bc2 (diff) | |
download | vyatta-cfg-system-841e41f385ca960fb703ff612b014d7e57560b3e.tar.gz vyatta-cfg-system-841e41f385ca960fb703ff612b014d7e57560b3e.zip |
Merge branch 'islavista' into jenner
Conflicts:
scripts/install-system
scripts/standalone_root_pw_reset
Diffstat (limited to 'scripts/standalone_root_pw_reset')
-rwxr-xr-x | scripts/standalone_root_pw_reset | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset index d7507d3b..8322f9d0 100755 --- a/scripts/standalone_root_pw_reset +++ b/scripts/standalone_root_pw_reset @@ -25,6 +25,10 @@ CF=/opt/vyatta/etc/config/config.boot # Admin user name ADMIN=vyatta +set_encrypted_password() { + sed -i \ + -e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password: \"$2\"/" $3 +} change_password() { local user=$1 @@ -33,9 +37,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" ] @@ -45,10 +49,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." @@ -103,7 +104,7 @@ change_password $ADMIN echo $(date "+%b%e %T") $(hostname) "Admin password changed" \ | tee -a /var/log/auth.log >>/var/log/messages - + sync echo "System will reboot in 10 seconds..." |