Open SSH/SFTP/mosh connections from Alfred 3 with autosuggestions based on SSH config files, /etc/hosts
and your history.
- Auto-suggest hostnames from
~/.ssh/*
and/etc/hosts
(sources can be individually disabled). - Remembers usernames, so you don't have to type them in every time. (You can also remove connections from your history or disable it entirely.)
- Alternate actions:
- Open connection with mosh instead of SSH.
- Open SFTP connection instead of SSH.
- Ping host.
The workflow reads hosts from the following sources (in this order of priority):
~/.ssh/config
- History (i.e. username + host addresses previously entered by the user)
~/.ssh/known_hosts
/etc/hosts
/etc/ssh/ssh_config
Download the latest release and double-click the file to install in Alfred.
Keyword is ssh
:
-
ssh [<query>]
— View and filter known SSH connections.↩
or⌘+<NUM>
— Open the connection.⇥
— Expand query to selected connection's title. Useful for adding a port number.⌘+↩
— Open an SFTP connection instead.⌘+⌥
— Open a mosh connection instead.⇧+↩
— Ping host.^+↩
— Forget connection (if it's from history).
There are several options available in the workflow's configuration sheet. Notably, you can turn off individual autosuggestion sources.
Variable | Description |
---|---|
DISABLE_CONFIG |
Set to 1 to turn off suggestions from ~/.ssh/config . |
DISABLE_ETC_CONFIG |
Set to 1 to turn off suggestions from /etc/ssh/ssh_config . |
DISABLE_ETC_HOSTS |
Set to 1 to turn off suggestions from /etc/hosts . |
DISABLE_HISTORY |
Set to 1 to disable the History (reading and writing). |
DISABLE_KNOWN_HOSTS |
Set to 1 to turn off suggestions from ~/.ssh/known_hosts . |
EXIT_ON_SUCCESS |
Set to 1 (default) to close shell if ping or mosh command exits cleanly |
EXTERNAL_TRIGGER |
Set to 1 to use an External Trigger instead of AppleScript to re-open Alfred. The External Trigger is safer, but leaves Alfred in a weird mode. |
MOSH_CMD |
Set to the full path to mosh if your shell can't find it. Set to empty to disable mosh connections. |
For SSH and SFTP connections, the workflow creates an ssh://
(or sftp://
) URL and asks the system to open it. These will open in whichever application you have configured to handle these URLs (Terminal.app is the default for ssh://
).
The ping
and mosh
commands use Alfred's Terminal Command output, which also call Terminal.app by default.
If you'd prefer to use iTerm2 rather than Terminal.app, there are two steps:
- To have
ping
andmosh
commands open in iTerm2, install @stuartcryan's iTerm2 plugin for Alfred. - To open
ssh:
connections in iTerm2, Set iTerm2 as the default handler forssh:
URLs in iTerm2's own preferences underProfiles > PROFILE_NAME > General > URL Schemes
:
This workflow is released under the MIT Licence.
It uses the following libraries and resources:
- ssh_config (MIT Licence) by havoc-io to parse SSH config files.
- awgo (MIT Licence) for the workflowy stuff.
- The icon is based on Octicons (SIL Licence) by Github.
This workflow started as a port of @isometry's Python SSH workflow to Go as a testbed for awgo. It has since gained some additional features.
If you need Alfred 2 support, check out @isometry's workflow.
- v0.7.1 — 2016-12-12
- Fix updater bug
- Smarter SSH URLs for hosts from
~/.ssh/config
- Better removal of duplicates
- v0.6.0 — 2016-11-09
- Add in-workflow updates
- v0.5.0 — 2016-10-31
- Add support for SSH configuration files (
~/.ssh/config
and/etc/ssh/ssh_config
) - Alternate action: open connection with
mosh
- Add support for SSH configuration files (
- v0.4.0 — 2016-05-27
- Add ability to turn sources of suggestions off #1
- v0.3.0 — 2016-05-26
- Alternate action: Open SFTP connection
- Alternate action: Ping host
- Remember connections with usernames, so you don't have to type the username each time
- v0.2.0 — 2016-05-23
- First public release