1

When logging into my cloud server, I receive this message:

WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user.
(current) UNIX password: 

I need to automate the process of entering the current password, and entering the new password after that.

However, every time I try to run a command I get an error saying WARNING: Your password has expired.\nPassword change required but no TTY available. (I am connecting via SSH on a Node.js app)

How can I get around this problem? Is there anyway I can run a command without getting that error so I can change the password?

1

You can force ssh to allocate a tty with the -t switch. Then, it might be possible to just pipe the old and new passwords in. You need to double the -t to force allocating a tty even when the stdin of the ssh client is not a terminal:

echo -en 'oldpw\nnewpw\nnewpw\n' | ssh -tt somehost true

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.