Hello,
I'm trying to create a ksh script to ssh to a remote server, enter the password and a couple commands. For security reasons I have changed the login, password and ip in my example.
#!/bin/ksh
ssh -t -t username@12.5.5.3 << EOF
password
cd bin
pwd
EOF
When I run it. It stalls at the password prompt and it will only continue when I manually enter it. I see the errors are produced due it entering the info too quickly. Is there a way for it to accept the password via script and then wait a certain amount of time before executing the commands? Also need it to exit the remote server when it completes. Any help is much appreciated, thanks.
Example results:
# /home/test/testscript.ksh
username@12.5.5.3's password: <----STALLS HERE. ONLY PROCEEDS WHEN I ENTER THE PASSWORD MANUALLY.
password
cd bin
pwd
[username@remoteserver ~]$ password
[1] 27729
-bash: pas: command not found
-bash: sword: command not found
[1]+ Exit 127 pas
[username@remoteserver ~]$ cd bin
[username@remoteserver bin]$ pwd
/home/user/bin
[username@remoteserver bin]$ <----STOPS AND STILL ON REMOTE SERVER.