您的位置:首页 > 运维架构 > Shell

SSH Login Shell

2015-12-08 10:44 591 查看

how to login into a remote host through ssh

1, write a shell script (login.sh), like:

#!/usr/bin/expect -f
set user root
set host 192.168.2.1
set password yourpasswd
set timeout -1

spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof


2, run the following command in a terminal

#this will run the shell script
expect ./login.sh


3, you can even do this with iTerms2

iTerms is a great alternative for the built-in terminal on MacOS. You can add in many sessions.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: