Share your clipboard across machines over SSH. There is no server daemon: the "server" is any host you can ssh into, and the shared clipboard is a single file on it.
# machine 1
echo 'hello' | cross-copy
# machine 2
cross-paste | catBoth commands also sync the system clipboard (Wayland, X11, macOS, Windows). If the server is unreachable, they fall back to the local clipboard.
- Put
cross-copyandcross-pasteon yourPATH(e.g.~/.local/bin). - Make sure key-based ssh to your server works:
ssh myserver true. - Create
~/.config/pastebin/config:
PASTEBIN_HOST=myserverRead from ${XDG_CONFIG_HOME:-$HOME/.config}/pastebin/config (a plain
shell fragment); environment variables take precedence.
| Variable | Default | Meaning |
|---|---|---|
PASTEBIN_HOST |
unset | ssh destination (~/.ssh/config aliases work). Unset or empty = local clipboard only. |
PASTEBIN_REMOTE_FILE |
.local/state/pastebin/clip |
Storage path on the server, relative to the remote home. |
PASTEBIN_SSH_TIMEOUT |
5 |
ssh ConnectTimeout in seconds. |
PASTEBIN_HOST is passed straight to ssh, so any alias works, including
hosts behind a ProxyCommand (e.g. an AWS SSM tunnel):
Host ssm-tunnel
HostName i-0123456789abcdef0
User myuser
IdentityFile ~/.ssh/id_ed25519
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
PASTEBIN_HOST=ssm-tunnel
PASTEBIN_SSH_TIMEOUT=15Tunneled connections can take longer than the default 5-second timeout to
establish; raise PASTEBIN_SSH_TIMEOUT if you see WARN: Could not push/fetch on first use while a retry succeeds. Auth must be key-based
(IdentityFile): the scripts run ssh with BatchMode=yes and will never
prompt for a password.
./test.shRound-trips a message through the server. Uses localhost by default;
point it elsewhere with PASTEBIN_TEST_HOST=myserver ./test.sh.