码迷,mamicode.com
首页 > 系统相关 > 详细

mac 操作系统使用iterm(2)自动登录远程服务器

时间:2020-03-03 20:41:43      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:rac   com   www   send   expect   shel   and   ora   一个   

  1. 找一个目录创建一个普通的文件,例如 vi myprofile ,编辑以下内容

    #!/usr/bin/expect
    
    set PORT 22
    set HOST www.****.com(或者ip地址)
    set USER bob
    set PASSWORD 123456
    
    spawn ssh -p $PORT $USER@$HOST
    expect {
                 "yes/no" { send "yes/y";exp_continue; }
                 "*password:*" { send "$PASSWORD\r" }
    }
    interact
  2. 选择 Profiles -> openProFiles(或者快捷键?+o),选中Edit Profile...

    技术图片

  3. 点击+号添加,选择command 填入 expect 加你刚才建的文件路径!/usr/bin/expect

    set PORT 22
    set HOST www.****.com(或者ip地址)
    set USER bob
    set PASSWORD 123456

    spawn ssh -p $PORT $USER@$HOST
    expect {
    "yes/no" { send "yes/y";exp_continue; }
    "password:" { send "$PASSWORD\r" }
    }
    interact技术图片

  4. 下次就可以直接选这个profile启动了

mac 操作系统使用iterm(2)自动登录远程服务器

标签:rac   com   www   send   expect   shel   and   ora   一个   

原文地址:https://www.cnblogs.com/rainymemory/p/12404209.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!