Give a friend a shell with Cave

Start an SSH server for an afternoon, let one person in with their public key, watch what happens, and close it again.

3 min to read

Sometimes a friend or a colleague needs a shell on your computer, or you need to copy files from your other machine. Setting up sshd for that is a lot: a system service, root, a configuration file. Cave is an ordinary program that does the same job while it is open.

Read this first: every session runs as you. A person who is connected can do what you can do on this computer: read and change your files, run your programs, use your network. Add only people you would trust with your own account.

Install#

With Go 1.27 or newer:

go install github.com/rm4n0s/cave/cmd/cave@latest
go install github.com/rm4n0s/cave/cmd/tcave@latest

cave is a desktop application with a tray icon and notifications. tcave is the same for the terminal; press ? in it to see the keys. This guide is true of both.

1. Ask your friend for their public key#

Your friend needs a pair of SSH keys. If they have none, they make one:

ssh-keygen -t ed25519

Then they send you the text of the public key. It is the file that ends in .pub, usually ~/.ssh/id_ed25519.pub (on Windows, in C:\Users\<name>\.ssh). It is one line, such as:

ssh-ed25519 AAAAC3Nza… alice@laptop

Never ask for the private key, the file without .pub. Cave refuses it when you paste it.

2. Open Cave and add the person#

Run cave (or tcave). The server does not start by itself: the Overview page says it is stopped.

Go to the People page and add a person:

  • The name, such as alice. It is what your friend types before the @ in ssh alice@your-computer. It is only a name in Cave, not a user of your computer.
  • The public key that they sent you.

Cave adds nobody without a key. There are no passwords.

3. Start the server#

Press Start on the Overview page. Cave listens on port 2222.

4. Send the ssh line#

The Overview page shows how to connect, for example:

ssh -p 2222 alice@192.168.1.20

Send that line to your friend. Your computer must be reachable by them: the same network, or a port opened on your router.

5. Watch#

  • Attempts lists every connection to Cave’s port: who it was, where from, what came of it and how many times. A person who is turned away shows why.
  • Connections lists the people who are connected now, and what each has open: a shell, a command, file transfer, forwarded ports.

If your friend cannot get in, the result on the Attempts page says what happened:

ResultWhat it means
Unknown nameThe name that was typed is nobody’s. Check the part before the @.
Wrong keyThe name is a person’s, but none of the keys offered is theirs.
No keyThe client offered no public key.
DisabledThe person exists but is disabled.

6. Close it#

Stop the server, or close Cave. Nobody can connect after that.

If you only want one person out, disable or remove them on the People page. That also disconnects the connections they have open right now.

What a connected person can do#

Besides a shell, a connected person may copy files (SFTP), forward ports, and forward their SSH agent. You can turn each of these off in Settings.

Where to go next#

Cave’s guide has everything else: people and keys, the settings, the files Cave keeps, macOS, Windows and troubleshooting. SECURITY.md says what Cave does and does not protect.