I am executing a BASH shell script (downloadScript.sh) on a remote server in the below way. Since the script takes more time to execute, the remote shell is getting timed out in between.

ssh -i aws.pem username@remoteserver "./downloadScript.sh"

Please let me know how can make sure that the remote shell alive till the script execution.

Error message I am receiving:

packet_write_wait: Connection to <remoteserver> port 22: Broken pipe

Note: I don't want to modify any configuration on remote server.


As per your comment to Vlastimil, You can use -o parameter in your ssh command. Example could be

ssh -o ServerAliveInterval=60 -i aws.pem username@remoteserver "./downloadScript.sh"

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.