PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Server deployment / 隔空贴服务器部署
The server only does two things: it lets your devices find each other (signaling), and relays encrypted traffic when a direct connection can't be established (TURN). It keeps no accounts and cannot read what you copy.
隔空贴的服务器只做两件事:让你的设备找到彼此(信令),以及在设备之间打不通直连时转发加密后的数据(TURN 中转)。它不存账号,也看不到你复制的内容。
You may not need one. Since 1.4.0, computers on the same network find each other and pair without a server, and computers on Tailscale pair by entering each other's Tailscale address. A server is for syncing across networks, or for subnets that can't reach each other.
**你可能用不着服务器。**从 1.4.0 起,同一网络里的电脑不用服务器就能互相发现、配对;装了 Tailscale 的电脑,配对时输入对方的 Tailscale 地址即可。服务器只在跨网络同步、或两个网段互相访问不到时需要。
Step-by-step guides with screenshots / 带截图的图文教程:
- Same network, no server / 同一网络,不需要服务器:https://pasteferry.cc/lan/
- On a public server / 公网服务器:https://pasteferry.cc/cloud/
- Tailscale, no server / Tailscale,不需要服务器:https://pasteferry.cc/tailscale/
- On your LAN, for subnets that can't reach each other / 在局域网里部署,网段之间互相访问不到时:https://pasteferry.cc/server/
Where to run it / 放在哪里
| Requirement 要求 | |
|---|---|
| Public server 公网服务器 | A Linux machine with a public IP; the smallest VPS is enough. Reachable from any network. 一台有公网 IP 的 Linux 机器,最低配的云主机就够,任何网络都能连上。 |
| On your LAN 局域网 | Any always-on Windows 10/11, macOS 13+ or Linux computer on the same network, one of your own computers included. Reserve its address in the router. 同一网络里任意一台常开的 Windows 10/11、macOS 13 以上或 Linux 电脑,自己的电脑也行;在路由器里给它固定地址。 |
| LAN + Tailscale 局域网 + Tailscale | Usually unnecessary now: computers on Tailscale pair by Tailscale address without a server. If you still want one, use an always-on computer at home with Tailscale; see Tailscale below. 现在一般用不着:装了 Tailscale 的电脑输入 Tailscale 地址就能配对,不需要服务器。仍想用服务器的话,放在家里一台常开、装了 Tailscale 的电脑上,见下面的 Tailscale。 |
It uses about 15 MB of RAM. 内存占用约 15 MB。
| Port 端口 | Protocol 协议 | Purpose 用途 |
|---|---|---|
| 8787 | TCP | Signaling (WebSocket) 信令 |
| 3478 | UDP | STUN / TURN |
| 32768–60999 (Linux), 49152–65535 (Windows, macOS) | UDP | TURN relay ports, assigned by the OS / 中转端口,系统随机分配 |
The install scripts below find the computer's LAN address, enable the TURN relay on it, register the server to start automatically, and print the address to enter in the apps. Running a script again upgrades in place and keeps your settings.
下面的安装脚本会找到本机的局域网地址并在它上面启用 TURN 中转、把服务器设为自动运行,最后打印出客户端要填的地址。重复运行即为升级,原来的设置保留。
Upgrading from CopySync (before 2.0.0): the install scripts stop and remove the old copysync-server service and carry its settings over. With Docker, remove the old container first: docker rm -f copysync-server.
从 CopySync(2.0.0 之前的名字)升级:安装脚本会停掉并删除旧的 copysync-server 服务,原来的设置照样沿用。用 Docker 的话先删掉旧容器:docker rm -f copysync-server。
Windows
Download pasteferry-server-windows-amd64.zip, extract it, and double-click install.cmd (it asks for administrator rights).
下载 pasteferry-server-windows-amd64.zip,解压后双击 install.cmd(会请求管理员权限)。
- Runs as the Windows service
PasteFerryServerunder the low-privilege LOCAL SERVICE account, starts with Windows and restarts after failures. 以低权限的 LOCAL SERVICE 账户注册为 Windows 服务PasteFerryServer,开机启动,出错后自动重启。 - Adds a Windows Firewall rule for
pasteferry-server.exeonly. 在 Windows 防火墙里只为pasteferry-server.exe添加一条入站规则。 - Wrong address picked? Run
install.cmd 192.168.1.20with yours. 认错了地址就运行install.cmd 192.168.1.20,换成你的地址。
| Program 程序 | C:\Program Files\PasteFerry Server |
| Settings 设置 | C:\ProgramData\PasteFerry Server\server.conf (administrators only 仅管理员可读) |
| Logs 日志 | C:\ProgramData\PasteFerry Server\server.log |
| Restart 重启 | Restart-Service PasteFerryServer (administrator PowerShell 管理员 PowerShell) |
| Uninstall 卸载 | double-click uninstall.cmd 双击 uninstall.cmd |
macOS
tar xzf pasteferry-server-macos.tar.gz
cd pasteferry-server-macos
./install.sh # or ./install.sh 192.168.1.20
No administrator rights needed: it registers a LaunchAgent that runs whenever you're logged in. Keep that Mac awake. If the macOS firewall is on, the script prints the command to allow the server through it.
不需要管理员权限:注册为 LaunchAgent,登录后自动运行。这台 Mac 不能睡眠。开着系统防火墙时,脚本最后会给出放行命令。
| Logs 日志 | ~/Library/Logs/PasteFerry/server.log |
| Restart 重启 | launchctl kickstart -k gui/$(id -u)/com.pasteferry.server |
| Uninstall 卸载 | ./install.sh uninstall |
Linux: systemd (recommended) / Linux:systemd(推荐)
tar xzf pasteferry-server-linux-amd64.tar.gz
cd pasteferry-server-linux-amd64
sudo ./install.sh # on a LAN: uses this machine's LAN address / 局域网:用本机的局域网地址
sudo ./install.sh <public IP> # on a cloud server / 云服务器:填公网 IP
The script installs the binary to /usr/local/bin, writes /etc/pasteferry/server.env with a random TURN secret, and registers a systemd service that starts on boot. If ufw or firewalld is active, it prints the commands to open the ports.
脚本会把程序装到 /usr/local/bin,生成配置 /etc/pasteferry/server.env(含随机的 TURN 密钥),注册为开机自启的 systemd 服务。开着 ufw 或 firewalld 时,最后会给出放行端口的命令。
journalctl -u pasteferry-server -f # logs / 日志
systemctl restart pasteferry-server # restart after editing the config / 改完配置后重启
pasteferry-server -version # version / 版本
sudo ./install.sh uninstall # uninstall / 卸载
On a cloud server, also open the ports above in the provider's security group. 云服务器还要在安全组里放行上面的端口。
Linux: Docker / Linux:Docker
cp env.example .env # set TURN_IP and TURN_SECRET / 填入 TURN_IP 与 TURN_SECRET
docker compose up -d
network_mode: host is required (already set in the compose file): TURN assigns a random UDP port per session, which port mapping can't expose. For the same reason Docker Desktop on Mac or Windows won't work; use the install scripts there.
必须使用 network_mode: host(compose 文件里已经写好):TURN 为每个会话随机分配 UDP 端口,端口映射模式下这些端口不可达。同样的原因,Mac 与 Windows 上的 Docker Desktop 不适用,请用安装脚本。
Tailscale
Since 1.4.0 you don't need a server for this: join every computer to the same Tailscale network and enter the other computer's Tailscale address when pairing (guide). The setup below still works if you prefer a server, for example so that the TURN relay is available.
从 1.4.0 起这种情况不需要服务器:每台电脑加入同一个 Tailscale 网络,配对时输入对方的 Tailscale 地址即可(教程)。下面的做法仍然可用,比如你希望有 TURN 中转兜底。
Without a public server you can still sync across networks: keep the server at home and join every computer, the server's included, to the same Tailscale network. Each device gets a fixed 100.x.y.z address that the others can reach from anywhere. Install the server on that address, so the TURN relay is reachable through Tailscale too, and enter it in every app.
没有公网服务器也能跨网络使用:服务器照样放在家里,所有电脑(包括服务器所在的那台)加入同一个 Tailscale 网络。每台设备会分到一个固定的 100.x.y.z 地址,在哪儿都能互相访问。服务器用这个地址安装(TURN 中转也就能通过 Tailscale 访问到),每台电脑也填这个地址。
tailscale ip -4 # the server's Tailscale address / 服务器的 Tailscale 地址,例如 100.101.102.103
install.cmd 100.101.102.103 # Windows
./install.sh 100.101.102.103 # macOS
sudo ./install.sh 100.101.102.103 # Linux, fresh install / Linux 首次安装
Windows and macOS switch to the new address when you run the script again. The Linux script keeps an existing config, so replace the old address (it appears in -turn-ip and -stun) in /etc/pasteferry/server.env and run systemctl restart pasteferry-server. Then use ws://100.101.102.103:8787/signal in the apps, at home too.
Windows 与 macOS 带上新地址再运行一次脚本即可切换。Linux 的脚本不改已有配置:把 /etc/pasteferry/server.env 里原来的地址(-turn-ip 与 -stun 两处)换成 Tailscale 地址,再 systemctl restart pasteferry-server。之后每台电脑都填 ws://100.101.102.103:8787/signal,家里的也一样。
On the server computer: turn on Run unattended in Tailscale on Windows (otherwise it disconnects when you sign out), and Disable key expiry for it in the Tailscale admin console. If 隔空贴 shows Direct but transfers are slow, tailscale ping <peer> tells you whether Tailscale itself is relaying through DERP. The same approach works with ZeroTier or any tool that gives each device a fixed virtual address.
服务器所在的电脑:Windows 上在 Tailscale 里打开 Run unattended(否则注销后会断开),并在 Tailscale 管理后台给它 Disable key expiry。隔空贴显示直连但传输很慢时,用 tailscale ping <对方> 看 Tailscale 自己是不是在经 DERP 中转。ZeroTier 等能给每台设备分配固定虚拟地址的工具,做法相同。
Run it directly / 直接运行
./pasteferry-server -addr :8787 -turn-ip <address> -turn-secret <random string>
-turn-ip is the address clients use to reach the relay: the LAN address on a LAN, the Tailscale address with Tailscale, the public IP on a cloud server. Without it there is no relay. -log <file> writes the log to a file instead of standard error. Run pasteferry-server -h for all options.
-turn-ip 是客户端访问中转用的地址:局域网里填局域网地址,用 Tailscale 时填 Tailscale 地址,云服务器填公网 IP;不填就没有中转。-log <文件> 把日志写到文件而不是标准错误。全部参数见 pasteferry-server -h。
Client setup / 客户端设置
The server field is empty by default, which means "this network only". On each computer (Mac or Windows), open 隔空贴 → Settings → Signaling server and enter the address the script printed:
「信令服务器地址」默认是空的,表示只在局域网里同步。
在每台电脑(Mac 或 Windows)上打开隔空贴 →「设置」→「信令服务器地址」,填入脚本打印的地址:
ws://<server address>:8787/signal
Then check http://<server address>:8787/healthz in a browser on another computer; it should show {"status":"ok",...}.
然后在另一台电脑的浏览器里打开 http://<服务器地址>:8787/healthz,应当显示 {"status":"ok",...}。
Behind an HTTPS reverse proxy, use wss:// and make sure the proxy forwards WebSocket upgrades. 放在 HTTPS 反向代理后面时用 wss://,代理需要支持 WebSocket 升级。
On a cloud server in mainland China, enter the IP rather than a domain unless the domain has an ICP filing: providers intercept plain HTTP for unfiled domains on any port, and the WebSocket handshake is plain HTTP. 国内云服务器上,域名没有备案时请直接填 IP:云厂商会拦截未备案域名的明文 HTTP 请求,任何端口都一样,而 WebSocket 握手就是明文 HTTP。