Skip to content

Instantly share code, notes, and snippets.

@ketankr9
Created December 7, 2017 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ketankr9/2f66ec77533851f6e4afcde80bae5536 to your computer and use it in GitHub Desktop.
Save ketankr9/2f66ec77533851f6e4afcde80bae5536 to your computer and use it in GitHub Desktop.
automated ssh login using expect
############### provide password of the login using script
#!/usr/bin/expect -f
spawn ssh username@host_ip
expect "username@remote_ip's password: "
send "password\r"
interact
###################################################
## B is my computer, A is the remote computer, transfer files from A to B.
scp username@A_ip:~/song.mp3 song.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment