1

I have lost root password of one old server, where i can only have normal user login and via webmin login. Via webmin interface i have one option to execute command, i have been trying the following but it fails:

> echo -e "newPassword\nnewPassword" | passwd root"
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file
> whoami
root

via webmin, i can see i am logged in as root

1

Use passwd instead of passwd root (or echo -e "newPassword\nnewPassword" | passwd root"). Moreover, your command have an unexpected '"' at the end too.

1
line 0: unexpected EOF while looking for matching `"'

That makes sense. Any time you have three quotes in a command line without any backslashes, you're asking for trouble. Those things are supposed to come in pairs.

echo -e "newPassword\nnewPassword" | passwd root

That's kinda clunky. I don't think it can work. It certainly doesn't for me.

This is a little better, but still bad:

usermod -p $(echo "newPassword" | openssl passwd -1 -stdin) root

Update: learned about chpasswd today:

echo "root:password" | chpasswd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.