安装tcl tclx tcl-devel
yum install -y tcl tclx tcl-devel
安装expect
yum install expect -y
创建文件ssh_quick.epr
#!/usr/bin/expect
if {$argc < 1} {
set remote_host "10.24.18.3"
} else {
set remote_host [ lindex $argv 0 ]
}
puts $remote_host
spawn ssh root@$remote_host
expect "*assword:"
send "123456\r"
expect "*#"
interact
然后就可以使用:
expect ~/ssh_quick.epr
完成快捷登录ssh的操作了。
ln -s shd="expect ~/ssh_quick.epr"
创建快捷方式进一步简化指令
本文介绍如何通过expect脚本实现SSH的快捷登录,包括安装必要的软件包tcl-tclx-tcl-devel和expect,创建并配置ssh_quick.epr脚本来简化远程主机的登录过程。
9422

被折叠的 条评论
为什么被折叠?



