I need to login to one development server to put things on live server.
So processor is like this
- Login to development server.
- Fire Deploy Script
- Deploy script asks for 3 password.
- Followed by ssh pass-phrase password.
I don’t have any other access on development and live server. So I can’t used key-based authentication. as well as I can’t install anything on the server.
Is it possible using expect or any other utility by using that I can automate this ?
I tried using like
spawn ssh deploy
expect_after eof { exit 0 }
expect "# "
send "deploy_to_server <branch_name>\r"
expect eof
expect "*password*" { send "passworrd" }
Edit
spawn ssh deploy
send "deploy_to_server <branch_name>\r"
expect eof
expect "*password*" { send "passworrd\n" }
You missed a line terminator in your send:
Apart from that, it seems quite nonsensical to expect eof first and then, without a respawn, wait for a password prompt.