美文网首页
mac系统ssh远程登录服务器小清新方案

mac系统ssh远程登录服务器小清新方案

作者: AI视客 | 来源:发表于2018-10-14 13:18 被阅读101次

Windows下有xshell,puty等一系列ssh软件,免费又好用,mac则没有。mac下虽然有SecureCrt,ZOC Terminal,但都还是收费的,虽说有破解版,但是版本落后不说,破解起来也麻烦。
经过本人一系列的研究,最终整出一套比较好用的方案,利用Shuttle+iTerm+ SSHPass来实现,这套方案清爽、轻便且实用。

Shuttle

github地址
A simple SSH shortcut menu for macOS 一个mac系统下轻便的ssh快捷菜单。

how-shuttle-works.gif

安装特别简单,这里略过。主要来看看设置:

Global Settings 全局设置

  • "editor": "VALUE",
    指定打开配置文件的编辑器,可选值有default, nano, vi, vim,比如:"editor": "vim", 将会使用vim打开~/.shuttle.json配置文件。
  • "launch_at_login": VALUE,
    指定是否在系统启动时自动运行shuttle.app,可选值为true或者false。
  • "terminal": "VALUE",
    指定使用的终端软件,可以是Terminal.app或者iTerm。
  • "iTerm_version": "VALUE",
    指定iTerm的版本,可选值有legacy、stable、nightly。
    legacy:2.14的版本
    stable:最新版本
    nightly:nightly编译版本,类似Chrome浏览器的nightly版本。
  • "default_theme": "Homebrew",
    设置终端的主题。
  • "open_in": "VALUE",
    设置是新标签还是新窗口打开,可选值为tab或者new。tab为新标签打开,new为新窗口打开。

主要是以上设置,还有些其他的设置可以到全局设置查看。

配置服务器

点击快捷菜单的shuttle小图标,设置-编辑。打开配置文件。

{
  "_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": "stable",
  "default_theme": "Homebrew",
  "open_in": "tab",  
  "show_ssh_config_hosts": false,
  "ssh_config_ignore_hosts": [  ],
  "ssh_config_ignore_keywords": [  ],
  "hosts": [
    {
      "cmd": "sshpass -p 密码 ssh root@xxx.xxx.xxx.xxx -p 22",
      "name": "一号服务器"
    }
  ]
}

cmd是ssh连接命令,这里我使用了SSHPass来保存密码。保存之后,点击快捷菜单shuttle小图标,就可以看到你配置的服务器名了,点击就会调用终端登录服务器。

iTerm

iTerm是一款高大上的mac终端模拟软件,官网地址。安装了iTerm,才可以在Suttle的配置文件里选择使用iTerm。

SSHPass

通过homebrew安装sshpass:

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

最后说一句,相比于Windows下海量实用的、开箱即用的软件,mac实在是适合爱折腾的用户,难怪mac被定位为极客使用的系统。

相关文章

网友评论

      本文标题:mac系统ssh远程登录服务器小清新方案

      本文链接:https://www.haomeiwen.com/subject/rnpzaftx.html