在系统bin目录中建立两个脚本分别是pssh tssh
pssh
#!/usr/bin/expect -f
set ip [lindex $argv 0 ]
set port [lindex $argv 1 ]
set password [lindex $argv 2 ]
set uname [lindex $argv 3 ]
set timeout 10
spawn ssh root@$ip -p$port
expect {
"*yes/no" { send "yes\r"; exp_continue}
"*password:" { send "$password\rclear\r\r\r请小心使用,您现在登录的服务器IP是:$ip,服务器名称是:$uname" }
}
interact
tssh
#!/bin/sh
echo "以下是你的所有服务器列表"
echo "1.A