Thursday, May 13, 2010
Script to Login to a remote machine with a given password
Posted on 7:38 AM by Unknown
#!/bin/bash
HOST="localhost"
USER="myuname"
PASS="mypassword"
VAR=$(expect -c "
spawn ssh $USER@$HOST
expect \"password:\"
send \"$PASS\r\"
expect \"\\\\$\"
send \"ls\r\"
expect -re \"$USER.*\"
send \"logout\"
")
echo "==============="
echo "$VAR"
ref : http://ubuntuforums.org/showthread.php?t=192929
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment