# Edit files over SSH with Skink (no sudo, clipboard works)

> Use Skink on a remote server over SSH, mosh or tmux: install the single binary without sudo, copy to your local clipboard with OSC 52, save root-owned files.

Source: https://skink.cc/remote/ssh-remote-editing/

Skink is one static binary with no runtime to install, so it works on a server over `ssh`, `mosh` or inside `tmux`. Install it into your home folder with the one-liner (no `sudo`), run `skink`, and text you copy reaches the clipboard of the machine you are sitting at, through OSC 52.

It needs no GUI, no X server and no desktop session. Anything that gives you a terminal is enough.

## Install Skink on the server

Log in and run the installer as your normal user:

```sh
curl -fsSL https://skink.cc/install.sh | sh
```

It puts `skink` in `~/.local/bin` and adds that to your `PATH`. No root, no package manager.

Linux builds are static musl binaries for x86_64 and aarch64, so they run on any distribution, old or new, including Alpine. See [Install](https://skink.cc/start/install/) for options such as a custom install folder.

### Install on a server without internet

1. Download `skink-<target>.tar.gz` from the [releases page](https://github.com/xuckless/skink/releases/latest) on your own machine.
2. Copy it to the server with `scp`.
3. Unpack it into any folder on your `PATH`.

## Copy and paste over SSH

When you copy or cut in Skink (Ctrl+C, Ctrl+X, or y on a path in the file tree), Skink does two things:

1. It sets the system clipboard of the machine Skink runs on, if there is one.
2. It sends an OSC 52 escape sequence, which asks *your* terminal to put the text on *your* clipboard.

So over SSH the text lands on your laptop's clipboard, provided your terminal allows OSC 52. Most modern ones do (Ghostty, Kitty, WezTerm, iTerm2, Windows Terminal, foot, Alacritty). Some ask for permission or need it turned on in their settings.

### Paste from your laptop

Use your terminal's paste key: Cmd+V on macOS, Ctrl+Shift+V in most Linux terminals. Skink receives it as one bracketed paste.

Ctrl+V inside Skink pastes from the server's clipboard, or what you last copied in Skink when the server has none.

**tmux:**
tmux only forwards OSC 52 from programs when its clipboard option allows it. If copies do not reach your machine, add `set -g set-clipboard on` to `~/.tmux.conf`.

## Save files you do not own

When a save fails with "permission denied", the status line asks whether to save with sudo: (y)es or (n)o.

Press y and Skink runs `sudo tee` in a terminal tab, where `sudo` can ask for your password. The tab closes once the file on disk matches your buffer.

You never have to restart the editor as root.

## Large files and logs

Files of 2 MB or more open as LARGE: no syntax colours and no language server. A big log or data dump opens quickly and stays responsive. Search, go to line (Ctrl+L) and editing work as usual.

### Dropped connections

Saves are atomic everywhere (temp file and rename, with permissions and symlinks kept), so a dropped connection never leaves half a file.

Unsaved edits are backed up after a 3 second pause. If the connection drops, open the file again and choose (r)ecover.

## Keys over mosh and tmux

Skink works in both. A few things to know:

- Skink turns on the kitty keyboard protocol only when it knows the terminal supports it. Through `tmux` or `mosh` it falls back to the classic key encoding, so a few chords arrive differently: Ctrl+Shift+D arrives as Ctrl+D, for example. See [Key bindings](https://skink.cc/customize/keybindings/) for workarounds.
- tmux's own prefix key (often Ctrl+B) shadows Skink's sidebar toggle. Use F8 for the file tree, type `sidebar` after Ctrl+E, or rebind one of them.

Every key also has a typed command, so a chord that tmux or mosh swallows is never out of reach: press Ctrl+E and type its name, such as `duplicate` or `comment`. See [Typed commands](https://skink.cc/editing/typed-commands/).

## Connecting from a Mac

The Option key on macOS types special characters, which can break Alt shortcuts. Skink translates most of them back, but it helps to set your terminal to send Option as Alt. See [macOS Option key](https://skink.cc/customize/macos-option-key/).

## Language servers on the server

Code intelligence runs where Skink runs. To get completion and go to definition on the server, install the language server there (for example `rust-analyzer` or `gopls`).

Without one, you still get syntax colours and every editing feature. See [Code intelligence](https://skink.cc/code/code-intelligence/).
