Expect Script to Login to Remote Server
!/usr/bin/expect
Script to login to remote server
spawn ssh user@domainoripaddress
expect "Password: "
send "password\n"
interact
Save the file as filename.exp and execute the file by below command
expect filename.exp
To make it more simple, write the expect execution command on your .bashrc or .bash_profile or .profile or whatever you use in alias method.
(ex:)
alias rslogin='cd /path/folder/ && expect filename.exp'
So, from now you need to type password or domain name to login into to your remote server.
Caution:
All your password will be available on your file without encryption, so beware of it.
Cheers!!!!
Written by Mothirajha Chandramohan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Network
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#