Tuesday, July 16, 2013

Password-less login

expect and automatic login

"expect" command is simply expecting a text from terminal, and send it when it meets expectation.
sudo apt-get install expect
Installation is done.

Sample usage.

Let's make simple shell program
vi abc.sh

Type into shell shell program.
#!/usr/bin/expect -f
set timeout 100
spawn ssh userid@servername 
expect "/home/devtrigger/.ssh/id_rsa" 
send "password\r"
expect "servername:"
send "bash\r"
interact



http://devtrigger.blogspot.com/2012/02/install-expect-on-ubuntu-11.html

http://greg-n-blog.blogspot.com/search/label/ssh

http://stackoverflow.com/questions/12202587/ssh-script-that-automatically-enters-password

http://stackoverflow.com/questions/4780893/use-expect-in-bash-script-to-provide-password-to-ssh-command

No comments:

Post a Comment