mac-iterm2+sshpass+shuttle实现ssh部分功能

安装iterm2

安装sshpass

  1. 下载sshpass源码
  2. 解压,tar -zxvf sshpass-1.06.tar.gz
  3. 进入解压目录,cd sshpass-1.06
  4. 检测当前环境,编译安装:
    ./configure
    sudo make
    sudo make install
  5. 检测是否安装成功:sshpass -h

安装shuttle

下载shuttle

下载地址:https://fitztrev.github.io/shuttle/

配置shuttle

点开设置->编辑,会打开.shuttle.json文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"_comments": [
"Valid terminals include: 'Terminal.app' or 'iTerm'",
"In the editor value change 'default' to 'nano', 'vi', or another terminal based editor.",
"Hosts will also be read from your ~/.ssh/config or /etc/ssh_config file, if available",
"For more information on how to configure, please see http://fitztrev.github.io/shuttle/"
],
"editor": "default",
"launch_at_login": false,
"terminal": "iTerm",
"iTerm_version": "nightly",
"default_theme": "Homebrew",
"open_in": "new",
"show_ssh_config_hosts": false,
"ssh_config_ignore_hosts": [ ],
"ssh_config_ignore_keywords": [ ],
"hosts": [
{
"cmd": "cd ~",
"name": "my iterm"
},
{
"Company_Project": [
{
"cmd": "sshpass -p ceshi123 ssh -o StrictHostKeyChecking=no root@127.0.0.1",
"name": "测试",
"inTerminal": "tab",
"theme": "Homebrew",
"title": "测试"
}
{
"cmd": "sshpass -p ceshi123 ssh -o StrictHostKeyChecking=no root@127.0.0.1",
"name": "测试",
"inTerminal": "tab",
"theme": "Homebrew",
"title": "测试"
}
]
}
]
}

对象中字段含义

  • cmd: 需要执行的命令
  • name: 菜单名
  • inTerminal: 命令执行窗口模式(可选值:new, tab, current)
  • theme: 终端主题
  • title: 终端显示标题(缺失时使用name作为标题)
shuttle效果

以下是效果图

配置效果

你可以配置你经常登录的服务器,这样可以免去每次登陆输入地址用户名密码了
缺点是服务器的用户名密码能被看到