All pages
Lesson 5.1 · Reach other machines · 12 min
SSH, SFTP and port forwards
Save hosts once, then connect, transfer files and forward ports.
Save the machines you work on once, then connect to any of them with one click, move files without leaving TRMNLY, and turn tunnels on and off by name. By the end of this lesson you will have a saved host, a working SFTP browser, and a port-forward preset.
Time: 12 minutes · Works on: macOS app
Everything here lives in the Conn tab of the right sidebar. The right sidebar shows five tabs directly. Conn is in the More menu at the end of the tab strip. You can also reach it from the menu bar with View → Right Sidebar → Connections.
Open the Conn tab
- Press
⌘⇧\to show the right sidebar if it is hidden. - Open the More menu at the end of the tab strip and choose Conn.
- Look at the section picker at the top of the tab. It has five sections: Hosts, SFTP, Tunnels, Containers and tmux.
Save a host
You can type a host in by hand or bring hosts over from your SSH config.
Import from your SSH config
- In Hosts, click the import button. Its tooltip reads Import hosts from ~/.ssh/config.
- The Import from ~/.ssh/config sheet lists every
Hostblock it found. - If a host has the same name as one you already saved, the row is marked CONFLICT. Use the Resolve picker to choose Skip, Replace existing, or rename the incoming host.
- Click the Import button, which shows how many hosts it will bring in.
Add one by hand
- Click the + button. Its tooltip reads Add a host.
- Fill in Name, User, Hostname and Port. Port 22 is the usual value.
- If you use a specific key, enter its path in the identity file field, for example
~/.ssh/id_ed25519. - Turn on Use mosh if the link is flaky and the server has
moshinstalled. - Turn on Connect on launch if you want TRMNLY to open a tab and connect each time it starts.
- To reach the host through a bastion, open Jump host chain and click Add jump host. Each hop is another saved host.
- Click Save.
Tip: The first connection to a new host pins its key. If the key changes later, the connection is refused instead of silently trusting the new key.
Connect
- Click into the terminal pane where you want the session.
- In Hosts, click the SSH button on the host's row. It reads Mosh if you turned mosh on.
- The connection command runs in the focused pane. If no terminal is focused, TRMNLY tells you to focus a tab first.
Expand a host's row with its chevron to see its quick panel. It shows:
- Port forwards: on/off switches for the presets attached to this host.
- SFTP…: opens the file browser for this host.
- tmux sessions: the tmux sessions running on the host. Click Discover sessions to query them, then Attach to join one.
Move files with SFTP
SFTP here needs passwordless SSH, which means a key or an SSH agent. A password prompt can't be answered from the browser.
- Expand the host's row and click SFTP…, or open the SFTP section and pick the host.
- Double-click a directory to go into it. Use the Up one directory button to go back, or type a path into Remote path.
- Select a file and click Download to copy it to your Mac.
- Click Upload… to send a file from your Mac to the current folder.
The browser is a quick preview built on ssh ls. For the full sftp client, use the button in the SFTP section whose tooltip reads Open the real sftp client in the focused terminal.
Set up a port-forward preset
A preset is a named group of forwarding rules attached to one host. Turning it on starts the tunnels in the background.
- Open the Tunnels section and click +.
- Give the preset a Name and pick its Host.
- Optionally pick a Project. The Ports panel then shows which project the tunnel serves.
- Under Rules, click Add rule and choose a type:
| Type | What it does |
|---|---|
| Local (-L) | Makes a port on the remote side reachable on your Mac |
| Remote (-R) | Makes a port on your Mac reachable from the remote host |
| Dynamic SOCKS (-D) | Runs a SOCKS proxy through the remote host |
- Fill in the ports, and the Remote host for a local forward, then click Save.
- Turn the preset on with its switch, in Tunnels or in the host's quick panel.
TRMNLY asks for confirmation before opening a remote (-R) forward or binding a port below 1024. It also warns when the server's GatewayPorts setting would expose the listener to your network.
Reattach tmux and screen sessions
The tmux section lists the tmux and screen sessions on your Mac.
- Click Attach to reattach in the focused pane.
- Use the second attach button, Attach in a new split (joins the grid), to open the session in a fresh split.
- Type a name into New session name and click Start to create a new tmux session.
Let the agent do it
The agent can use your saved hosts by name. Try asking it:
- "Run
uptimeon staging." (use the name of a host you saved) - "Download
/var/log/app.logfrom staging and show me the last errors."
It uses ssh_exec, sftp_read and sftp_write for this. Each one goes through the approval rules you set in Safety and approvals.
Check yourself
- A host you saved appears in Hosts, and its SSH button opens a session in the focused pane.
- SFTP… on that host lists its home directory, and you can download one file.
- A preset in Tunnels turns on, and the forwarded port answers on your Mac.
Go further
- Connections: every field, the import wizard and multiplexers
- Ports: see your tunnels next to every other listener
- Splits: grid layouts for the sessions you attach