diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-22 12:32:34 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-22 14:56:36 -0700 |
commit | 0891dd1e867690606889991d3ae2fdb24674375c (patch) | |
tree | eb6b0fd43ffedd83bef944bb1ae52e6317d560c7 /scripts/standalone_root_pw_reset | |
parent | a84c251730371dce36dfad28c62ded791b552944 (diff) | |
download | vyatta-cfg-system-0891dd1e867690606889991d3ae2fdb24674375c.tar.gz vyatta-cfg-system-0891dd1e867690606889991d3ae2fdb24674375c.zip |
More fixes to standalone password reset
Previous changes introduced lots of typos.
Diffstat (limited to 'scripts/standalone_root_pw_reset')
-rwxr-xr-x | scripts/standalone_root_pw_reset | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset index e50312bc..c13746a0 100755 --- a/scripts/standalone_root_pw_reset +++ b/scripts/standalone_root_pw_reset @@ -84,8 +84,7 @@ fi # OK, now we know we are running in standalone mode. Talk to the # user. # -echo "Do you wish to reset the admin password?" - +echo -n "Do you wish to reset the admin password? (y or n) " read -t $TIME_TO_WAIT response if [ "$?" != "0" ]; then echo @@ -111,12 +110,12 @@ echo "Starting process to reset the admin password..." echo "Re-mounting root filesystem read/write..." mount -o remount,rw / -if ! -f /opt/vyatta/etc/config -then dead "Missing Vyatta config directory..." +if [ ! -f /etc/passwd ] +then dead "Missing password file" fi -if ! -f /etc/passwd -then dead "Missing password file..." +if [ ! -d /opt/vyatta/etc/config ] +then dead "Missing Vyatta config directory /opt/vyatta/etc/config" fi # Leftover from V3.0 @@ -126,31 +125,31 @@ then mount /opt/vyatta/etc/config/ fi -if ! -f $CF -then dead "$CF file not found..." +if [ ! -f $CF ] +then dead "$CF file not found" fi -if ! grep -q '^system {' $CF -then die "$CF file does not contain system settings..." +if ! grep -q ' system {' $CF +then dead "$CF file does not contain system settings" fi if ! grep -q ' login {' $CF then # Recreate login section of system - sed -i -e '/^system {/a\ - login { \ + sed -i -e '/ system {/a\ + login {\ }' $CF fi if ! grep -q " user $ADMIN " $CF then echo "Recreating administrator $ADMIN in $CF..." - sed -i -e "/ login {/a\ - user $ADMIN { \ - authentication { \ - encrypted-password "$1$4XHPj9eT$G3ww9B/pYDLSXC8YVvazP0" \ - } \ - level admin \ + sed -i -e "/ login {/a\\ + user $ADMIN {\\ + authentication {\\ + encrypted-password \"$1$4XHPj9eT$G3ww9B/pYDLSXC8YVvazP0\"\\ + }\\ + level admin\\ }" $CF fi |