One of my companies customers runs an IPSwitch sftp server, and they have disallowed public key authentication, and require us to change our password every 90 days.

The problem is that, I cannot see any way to, in advance, proactively change the password. What happens is that when a login attempt happens after the password has expired, you get an authentication error and a prompt to change the password. Since our systems are all automated, I need a way to change it automatically.

I was thinking I'd just write something that would catch the error and initiate a script that would attempt to login, read the password prompt from stdout/stderr, and send the new password back via stdin, and I'd be all good.

The problem with this approach is that the regular ssh client is using a separate tty in order to send the password prompt / etc..., so my normal stdout/stderr catching isn't working (see the answer at http://goo.gl/p1xOPu for an explanation).

I may end up going the route of setting up a pseudo-tty as described in that answer, but it looks like it's pretty involved, so I figured I'd see if anyone here had any better ideas.

Thanks :)

migrated from serverfault.com Feb 9 '16 at 19:41

This question came from our site for system and network administrators.

Your Answer

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

Browse other questions tagged or ask your own question.