mac 无密码登录远程服务器

mac 无密码登录远程服务器

记录贴 使用expect 脚本 快速通过跳板机连接远程服务器

新建脚本 login.exp
示例如下:

#!/usr/bin/expect

#定义数组
#连接枚举
set connection_enum(1) "179"
set connection_enum(2) "gpu线上机器)"
set connection_enum(3) "ocr开发)"
set connection_enum(4) "ocr线上)"

#用户枚举
set connection_user(1) "seven"
set connection_user(2) "ubuntu"
set connection_user(3) "ubuntu"
set connection_user(4) "ubuntu"

#连接密码
set connection_passwd(1) "xxxxx"
set connection_passwd(2) "xxxx"
set connection_passwd(3) "xxxxxx"
set connection_passwd(4) "xxxxxxxxx"

#连接ip
set connection_ip(1) "10.10.0.0"
set connection_ip(2) "0.0.0.1"
set connection_ip(3) "127.0.0.1"
set connection_ip(4) "127.0.0.2"

#函数定义必须在使用前面否则会报错
#列出可用的host以及枚举
proc connectionlist {} {
    global connection_enum
    #[array size connection_enum]命令是求数组connection_enum的长度
    for {set i 1} 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值