Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 158

Linux shell scripting

$
0
0

I want to login to remote server and run multiple commands on the same and exit. As on the remote server I am not having root access, so I am unable to use sshpass. Hence I was trying to use expect command/script as follow:

#!/usr/bin/expect -fset timeout -1spawn ssh username@ip_address /bin/bash << "EOF"expect "username@ip_address's password:"send "password\r"interactlspwdcd#multiple commandsEOF

In above code I was able to login to my remote sever, however I am not able to use EOF / multiple commands.Help will be appreciated.


Viewing all articles
Browse latest Browse all 158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>