An SSH server with a window v0.11.8

An SSH server you start, watch and stop.

Cave gives a friend, a colleague or your own other computer a shell or a file transfer for a while, without setting up a system service. You add the people you trust and their public keys, start the server, and see who tried to connect, who is connected and which files they moved. When you are done, you close it.

Get started GitHub Documentation

go install github.com/rm4n0s/cave/cmd/cave@latest
The Overview page of Cave: the server running on a port, the fingerprint of the host key, the ssh line to connect, and the counts of people, connections and attempts The People page with alice enabled and bob disabled, each with one key The Attempts page with three lines: an unknown name that tried twice, a wrong key, and an accepted login The Connections page with alice connected from 127.0.0.1, and the buttons Disconnect and Disconnect all The History page with the tabs Connections and Transfers, and two connections of alice that ended with Client left The Settings page: the port, the address, Start when Cave starts and the keep-alive

Start and stop the server, and copy the ssh line that you send to a person.

A person is a name and one or more public keys. A disabled person cannot connect, and keeps their keys.

Every connection to Cave’s port is listed, with who it was, where from, what came of it and how many times.

Who is connected now, from which address, since when, and what they have open. Disconnect one, or all of them.

Who was connected, for how long and how it ended, and which files they uploaded and downloaded. It stays after Cave is closed.

Settings take effect at once. The port and the address can change while the server runs, and the open connections stay.

0 passwords

A person gets in only with a public key that you gave to their name

0 root

Cave is an ordinary program, and every session runs as you

3 systems

Linux, macOS 14 or newer, and Windows 10 (version 1809) or newer

2 programs

with the same features, cave for the desktop and tcave for the terminal

  • Open for a while, then closed

    The server does not start by itself. You press Start when somebody needs to come in, and you close Cave when you are done. There is no system service to set up or to forget.

  • Public keys only

    There are no passwords. A person gets in only when their name is one you added and they prove a key that you gave to that name. A private key pasted by mistake is refused, and never kept or logged.

  • You see who knocks

    Cave shows who tried to connect and how many times, who is connected and for how long, and which files they uploaded and downloaded. A person who is turned away shows why.

First use, in five steps

The server does not start by itself, and Cave needs no installation beyond the program.

  • Open it. The Overview page says that the server is stopped.
  • Add a person with a key: a name such as alice, and the text of their public key, the file that ends in .pub. Cave adds nobody without a key.
  • Press Start. Cave listens on port 2222.
  • Send the person the ssh line that the Overview page shows, for example ssh -p 2222 alice@192.168.1.20. Your computer must be reachable by them: the same network, or a port opened on your router.
  • Watch the Attempts page. Every connection to Cave’s port is listed there.
The Overview page of Cave on a Mac, with the server stopped: the button Start server, the host key, the ssh line and the counts

What you see and what you decide

Everything here is true of both programs, the desktop application and the one for the terminal.

People and keys

A name and a public key for each person

The name is what the person types before the @ in ssh alice@your-computer. It is not a user of your computer, only a name in Cave. Paste the text of their public key under it, or import a .pub or an authorized_keys file.

  • Accepted keys: ssh-ed25519, the three ECDSA kinds, ssh-rsa of 2048 bits or more, and the two kinds of security key
  • Each key is shown by its fingerprint, as ssh-keygen -l shows it
  • A key belongs to one person only
  • Renaming, disabling or removing a person disconnects the connections that the person has open
The dialog Add keys to alice with a pasted private key, and the sentence that refuses it: This is a private key. Paste the public key instead

Attempts

Every knock on the door, counted

Every connection to Cave’s port is one attempt, whatever happens on it. Repeated attempts from the same address, with the same name and the same result, are one line with a count.

  • Select a line to see the address, the client’s program and version, and the fingerprints of the keys it offered
  • What a client sends before it has logged in is not trusted. Cave replaces control characters in it before showing it.
  • The list keeps at most 5 000 lines, and a setting can clear it every hour, day, week or 30 days
  • At most 64 connections wait for their login at a time, and 8 from one address
The Attempts page: the filters All, Accepted and Refused, a search field, and the lines Unknown name with the count 2, Wrong key and Accepted

History

What happened, also after you closed it

The History page remembers every connection that logged in, the newest first, and every file that a person uploaded or downloaded with sftp, scp or sshfs.

  • How a connection ended: the client left, you disconnected it, the person or the key changed, it stopped answering, or the server stopped
  • For each file: who, the file, upload or download, its size, when, and whether it was done, failed or interrupted
  • The history keeps the names of files, never what is in them or what was typed
  • It takes at most about 8 MiB, and the oldest records go first
The History page with the tab Connections: two connections of alice from 127.0.0.1, their duration, and Client left

Settings

A switch for each thing a person may do

A connected person may run a shell or a command, copy files, forward ports, and forward their SSH agent. You can turn each of these off in Settings, and a change takes effect at once.

  • sftp.enabled allows sftp and scp
  • forwarding.local allows ssh -L and ssh -D, and forwarding.remote allows ssh -R, on this computer’s loopback address only unless you say otherwise
  • forwarding.agent allows ssh -A
  • server.address set to 127.0.0.1 makes Cave reachable only from this computer
  • Cave disconnects a client that has gone silent. server.keepAliveSeconds says how often it checks.
The Settings page of Cave, which starts with the server: the port, the address, Start when Cave starts and the keep-alive in seconds

tcave

The same in a terminal

tcave is the application for the terminal, with the same pages and the same features. Press ? to see the keys. The desktop application adds a tray icon and notifications.

  • Both programs take the same flags, and a flag is for one run and is never saved
  • --port listens on another port for this run
  • --config-dir and --state-dir run Cave on other folders, to try it without touching your own
[1 Overview]  2 People  3 Attempts  4 Connections  5 Settings
Server      running on port 45099   (s stops it)
Host key    SHA256:SL0wATVQaDDy07MmYos8vKaA7mfQm32dz/AldWbJhIw
            A person sees this the first time they connect.

How to connect, for a person named alice:
  ssh -p 45099 alice@127.0.0.1

People 2   Connected now 0   Attempts in the list 0

s start or stop the server   ? keys   q quit

What a person can do once inside

Cave does the job of sshd. Its tests run the real ssh, sftp and scp of OpenSSH against it.

  • A shell or a command

    ssh alice@host and ssh alice@host ls, with the same files, programs and network you have. A shell starts in your home folder.

  • File transfer

    sftp, scp, sshfs, and editors that work over SFTP, over the whole file system that you can reach.

  • Port forwarding

    ssh -L and ssh -D open connections from this computer. ssh -R makes Cave listen on a port of this computer.

  • Agent forwarding

    ssh -A lets the programs of the session use the person’s keys, which stay on the person’s computer.

  • Who is who

    A session gets your usual variables, plus CAVE_PERSON with the person’s name. It does not get Cave’s own environment.

  • Private files

    The people, the host key and the settings are written readable by you only, in a way that a crash does not leave half a file. The history is readable by you only too.

  • A log

    cave.log has one JSON line for each thing that happened. It never has a private key or what a session said.

  • The tray and notifications

    The desktop application can keep running in the tray, and shows a notification when somebody connects.

What the Attempts page says

A person who is refused looks there first. To the client, an unknown name, a disabled person and a wrong key all look the same.

ResultWhat it means
AcceptedThe person got in.
Unknown nameThe name that was typed is nobody’s.
DisabledThe person exists but is disabled.
Wrong keyThe name is a person’s, but none of the keys offered is theirs. The line says if the key belongs to somebody else.
No keyThe client reached the login and offered no public key.
Not provenThe client offered a key that is the person’s, but could not prove it holds the private half.
Handshake failedThe connection ended before the login began: a port scanner, a program that does not speak SSH, or a client that was too slow.
RefusedCave closed the connection at once because too many were waiting.

The table is from docs/GUIDE.md, which also has people and keys, the settings, the files Cave keeps, the command line, macOS, Windows, and what to do when something goes wrong.

Built on Glutter, installed by Soft

The desktop application is built on my own GUI toolkit. Cave has a soft.toml, so Soft installs both programs with their entries in the menu and Cave’s logo.

What Cave does not protect

Be clear about this before you add anybody.

  • A person who connects is you. Every session runs as the operating system user who started Cave: your files, your programs, your network. There is no sandbox, and no way to give one person less than another.
  • People are not separated from each other. Two people connected at the same time run as the same user, and can see each other’s processes and files.
  • A forwarded agent can be used by everything that runs as you, and by any other person who is connected at the same time. Turn forwarding.agent off if you do not want it.
  • Cave is not a system service and not a firewall. Anybody who can reach the port can try to connect. Use your firewall or router to decide who can reach it.
  • It does not support certificates, or options in an authorized_keys line such as command="…".
  • On macOS, cave is a plain program, not an app bundle. Start it from the Terminal.

Under the hood#

Cave is for people who want to give a friend, a colleague or their own other computer a shell or a file transfer for a while, without setting up a system service.

You open it, add the people you trust and the public keys they connect with, and start the server. Cave shows who tried to connect and how many times, who is connected and for how long, and which files they uploaded and downloaded. When you are done, you close it.

Every person who connects gets a session that runs as you, so add only people you would trust with your own account. There are no passwords, only public keys. Cave does not run as root unless you tell it to.

There are two programs with the same features: cave, a desktop application with a tray icon and notifications, and tcave, an application for the terminal.

Cave keeps its files in two folders of your own: the settings, the people and the host key in the configuration folder, and the attempts, the history and the log in the state folder. Only one Cave can use a pair of folders at a time. Back up the configuration folder to keep your people and your host key.

Every security rule of the project has a test, and docs/SECURITY.md names each rule with the tests that prove it.

Kind
Application
Language
Go
Runs on
Linux, macOS, Windows
License
BSD-3-Clause
Version
v0.11.8

Guides for Cave

The logo of Cave: a cat in a cave, holding a torch

Start with one command

You need Go 1.27 or newer. Cave needs no installation beyond that, and no C compiler. Add only people you would trust with your own account.

Give a friend a shell with Cave Source on GitHub Documentation

# The desktop application
$ go install github.com/rm4n0s/cave/cmd/cave@latest
# The application for the terminal
$ go install github.com/rm4n0s/cave/cmd/tcave@latest
# Open it. The server waits until you press Start
$ cave
# Or open the one for the terminal
$ tcave