Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pastebin

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.

Usage

# machine 1
echo 'hello' | cross-copy

# machine 2
cross-paste | cat

Both commands also sync the system clipboard (Wayland, X11, macOS, Windows). If the server is unreachable, they fall back to the local clipboard.

Setup

  1. Put cross-copy and cross-paste on your PATH (e.g. ~/.local/bin).
  2. Make sure key-based ssh to your server works: ssh myserver true.
  3. Create ~/.config/pastebin/config:
PASTEBIN_HOST=myserver

Configuration

Read 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.

Using an ~/.ssh/config alias

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=15

Tunneled 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

./test.sh

Round-trips a message through the server. Uses localhost by default; point it elsewhere with PASTEBIN_TEST_HOST=myserver ./test.sh.

About

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.

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages