需先运行 pbgopy serve 并保证各设备能访问默认 9090 端口;客户端需设置 PBGOPY_SERVER 环境变量指向服务端;用 GPG 加密需本机已安装 gpg 可执行文件
brew install nakabonne/pbgopy/pbgopyREADME 未说明,仅提供各平台二进制、包管理器与 Docker 安装方式
跨设备共享剪贴板的命令行工具,像 pbcopy/pbpaste 一样复制粘贴
跨设备复制粘贴的命令行工具,通过中继服务器在终端间同步剪贴板内容,省去手动传输的麻烦。
核心能力
- 自建 HTTP 服务端充当多设备共享剪贴板
- 支持对称密钥、RSA 公私钥及 GPG 端到端加密
- 服务端保留历史条目,可按 ID 粘贴或删除
- 支持 HTTP Basic Auth 认证与 TTL 自动过期
- 可直接读取本机系统剪贴板内容上传
容易踩的坑
- v0.4.0最新正式版2026-04-29 · 2026-04-29 08:59 UTC
What's Changed
Clipboard history support
pbgopynow supports clipboard history on the server side.To keep multiple entries, start the server with
--history-limit:pbgopy serve --history-limit 20Each successful copy creates a history entry.
pastestill returns the latest entry by default:pbgopy copy < first.txt pbgopy copy < second.txt pbgopy paste > latest.txtYou can list stored entries with the new history command:
pbgopy historyExample output:
ID AGE TYPE SIZE LATEST PREVIEW fcd0bc9afd9586c4544c377024d4e3b1 4s text/plain; charset=utf-8 6B * "world" f9db4d7b8befb5d8b86b39e58b695126 9m image/jpeg 1.6MB JPEG image 3144x4192You can paste a specific entry by ID:
pbgopy paste --id f9db4d7b8befb5d8b86b39e58b695126 > foo.jpgUse --history-limit 0 for unlimited in-memory history.
Notes
The default history limit is 1, so existing latest-only workflows continue to work as before.
Changelog
- 454e5ab67f8028fcf6b87cbe5f177f1298928ef1 Set up Buildx for release Docker images (#40)
- 01c66e564bb088f37eb5cd0ed3ece183b0da2bd0 Disable Docker SBOM attestation (#39)
- ed6740f3e1fe78e0d07f74dc8384e223770b17c7 Prepare release workflow for v0.4.0 (#38)
- df6e07d3fda7f697f565c965b7531bb3c734c109 Add clipboard history support (#37)
- 90269e2c1d29fb2210dc6ddededa8f403803eee9 Fix CI: update Go versions and golangci-lint (#36)
- 66749855046bb410362bc37380762968bc35b07e Fix how to install via Go
- b6f80e71f39b78275d508ba08978318ec2b311f8 Update README.md
- 21b29a565f258be0c90c23ebf967b0cd6453ebf2 Bump Go to 1.16
- 356c589fb58ef23f3082fd0ddcc72d68f43e2323 Add info on how to use command-line options
- v0.3.02020-12-28 · 2020-12-28 12:39 UTC
查看更新说明
pbgopy v0.3.0 is here!! 🎉
It's a feature-packed release with tons of features for secure use.
Hybrid cryptosystem is now available (https://github.com/nakabonne/pbgopy/pull/25)
pbgopy comes with a built-in end-to-end encryption feature. You can now encrypt with not only the symmetric-key but also your public/private key. If you have already exchanged public keys between devices you want to share data with, this is the way to go.
You can simply encrypt/decrypt by specifying the key file:
pbgopy copy --public-key-file /path/to/public.key <plaintext.txtpbgopy paste --private-key-file /path/to/private.key <plaintext.txtNote that you can only use an RSA key in PEM or DER format.
Specify public/private key via GPG (https://github.com/nakabonne/pbgopy/pull/27)
You manage your keyring in GPG? The
--gpg-user-id(-u) flag is for you! Suppose you want to encrypt with a public key whose user id isalice:pbgopy copy -u alice <plaintext.txtThen you decrypt it with the private key by specifying the user id on another device:
pbgopy paste -u aliceThere are a couple of ways to specify a user ID. Visit here to see the entire list.
Existing symmetric-keys are now available (https://github.com/nakabonne/pbgopy/pull/23)
As in the past, you can derive the key from password with the
-pflag, which is provided so that you can encrypt/decrypt without previous setting, while this way cannot prevent a dictionary attack. For more safety, it is highly recommended to use a 32-bytes symmetric key generated by other methods. The-kflag or thePBGOPY_SYMMETRIC_KEY_FILEenvironment variable is available to indicate the path to the key file.pbgopy copy -k /path/to/pbgopy.key <plaintext.txtPerformance improvements
- Reduced unnecessary communication when deriving the key from the password (https://github.com/nakabonne/pbgopy/pull/28)
Breaking changes
- The
PBGOPY_PASSWORD_FILEenvironment variable has been unavailable. - The interface between pbgopy server and client has been slightly changed, hence you will need to update the binaries on all devices to use this version.
Changelog
0af2a5b Add information on how to use hybrid cryptography (#29) 06d10e8 Ensure to give back stderr when GPG failed cc6ca28 Add check if multiple keys are specified f2a81ac Stop using salt when deriving key from password (#28) 4d255f4 Enable to specify public/private key via GPG (#27) 8f4ca3a Support encrypted private keys (#26) 31b8bab Enable hybrid cryptosystem (#25) f11af4c Rename encryption parameters 50bc455 Add functions to encrypt/decrypt with RSA (#24) b61ded0 Slice off leading and trailing white space of key b4d10bc Enable to directly give symmetric-key (#23) efbe459 Make the hash function common
Docker images
docker pull nakabonne/pbgopy:latestdocker pull nakabonne/pbgopy:v0.3.0docker pull nakabonne/pbgopy:v0.3
- v0.2.12020-12-13 · 2020-12-13 12:16 UTC
查看更新说明
pbgopy v0.2.1 is here.
- Support
--from-clipboardoption to put the data at the clipboard on your OS. - Enable to set password via the
PBGOPY_PASSWORD_FILEenvironment variable. - Expose
/lastupdatedendpoint to tell when to update the current content. This is for the extension tool for pbgopy
Changelog
87286c2 Add description to tell how to use --from-clipboard option 2bb3509 Merge pull request #21 from thealamu/iss#17 5db914a Remove unneeded log 5652c16 Merge pull request #12 from name-schema/automating-password-entry-issue-5 4c95f4a Default read source to stdin 76dd4ea Allow setting --max-size on clipboard source 8c7b720 Merge pull request #20 from IvarWithoutBones/nix-readme 317dd4b Add Nix installation instructions 24f7564 Merge branch 'main' into automating-password-entry-issue-5 32ef963 Issue #5 - Addressed CR comments 18cba7a Use strong pseudo-random number generator for salt e67fd38 Remove unneeded private function ffc124a Handle the case of cache not found 5281a59 Read data from clipboard if option is specified 7f8595e Register a from-clipboard flag fc73b4c Remove unneeded multi getter 46e20b8 Be more clear cache key name a792f24 Merge pull request #16 from thealamu/feat/lastupdated 3363c6f Update installation instructions 7553882 Test lastupdated path 7ce9148 Update timestamp in cache on put 3c587cd Implement handler for getting lastupdated timestamp 4932bed Register the lastupdated path 8e0c51a Issue #5 - Automating Password Entry
Docker images
docker pull nakabonne/pbgopy:latestdocker pull nakabonne/pbgopy:v0.2.1docker pull nakabonne/pbgopy:v0.2
- Support
- v0.2.02020-12-05 · 2020-12-05 01:49 UTC
查看更新说明
pbgopy v0.2.0 is here 🎉
Support basic authentication
You can now perform a minimum of authentication via an HTTP Basic Authentication.
pbgopy serve -a user:passpbgopy copy -a user:pass <foo.pngpbgopy paste -a user:pass >foo.pngMax size is now configurable
--max-sizeoption is now availablepbgopy copy --max-size 100mbpbgopy paste --max-size 100mbAnd fixed an encryption vulnerability
Changelog
c2094de Add authentication section f3764ac Add max-size option to paste command b0c75a1 Contain modified part of datasize 4bf3404 Merge pull request #10 from thealamu/iss#2 0c5478d Update tests, add float datasize test 1ad54dd Remove unnecessary comments 61ae8c5 Check single error results on the same line 43ff909 Fix failing tests d9ee796 Add tests for readNoMoreThan and datasizeToBytes 46a0a69 Don't allocate buffer memory ahead of time d6978d1 Allow users specify human-readable data sizes bff38f6 Fix lint errors 025c7d9 Fail when copy data exceeds defined maxSize (#1) d903987 Merge pull request #14 from azunymous/main 9fa846f Change create server to be private 0fcfd7e Merge pull request #13 from pjvds/patch-2 c1b4d79 Merge pull request #11 from name-schema/no-empty-nonce-issue-4 d011c7e Add server tests for copy and paste adc20a5 Add basic authentication to commands 4d97c1c docs: add AUR package to README 2ada86e Issue #4 - Made GetNonce func private 4fbed2c Issue #4 - Adding back the RandomBytes function 4c39fec Issue #4 - Stop using an empty nonce for GCM b77c9c2 Rename crypt package to crypto 5e99fdb Modularize encryption/decryption package (#9) 416dc4f Put salt into cache for concurrent use 497dfb1 Derive a secure encryption key based on the password (#8) 9e86a26 Update demo to clarify it uses different devices
Docker images
docker pull nakabonne/pbgopy:latestdocker pull nakabonne/pbgopy:v0.2.0docker pull nakabonne/pbgopy:v0.2
- v0.1.12020-11-28 · 2020-11-28 11:27 UTC
查看更新说明
Changelog
e6d3359 Use password option instead of key (#1) 8bb5cf1 Fix import order
Docker images
docker pull nakabonne/pbgopy:latestdocker pull nakabonne/pbgopy:v0.1.1docker pull nakabonne/pbgopy:v0.1
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
pbgopy
pbgopy acts like pbcopy/pbpaste but for multiple devices. It lets you share data across devices like you copy and paste.

Installation
Binary releases are available through here.
macOS
brew install nakabonne/pbgopy/pbgopy
RHEL/CentOS
rpm -ivh https://github.com/nakabonne/pbgopy/releases/download/v0.4.0/pbgopy_0.4.0_linux_amd64.rpm
Debian/Ubuntu
wget https://github.com/nakabonne/pbgopy/releases/download/v0.4.0/pbgopy_0.4.0_linux_amd64.deb
apt install ./pbgopy_0.4.0_linux_amd64.deb
Arch Linux
AUR package is available: pbgopy
yay pbgopy
Nix
nix-shell -p nixpkgs.pbgopy
Go
go install github.com/nakabonne/pbgopy@latest
Docker
docker run --rm nakabonne/pbgopy pbgopy help
Usage
First up, you start the pbgopy server which works as a shared clipboard for devices. It listens on port 9090 by default. You must allow access to this port for each device you want to share data with.
pbgopy serve
Populate the address of the host where the above process is running into the PBGOPY_SERVER environment variable. Then put the data entered in STDIN into the server with:
export PBGOPY_SERVER=http://host.xz:9090
pbgopy copy <foo.png
Paste it on another device with:
export PBGOPY_SERVER=http://host.xz:9090
pbgopy paste >foo.png
History of copies
To keep previous copies, start the server with a larger history limit:
pbgopy serve --history-limit 20
Each successful copy creates a new history entry and paste still returns the latest entry by default. You can list entries without printing full clipboard contents, paste a specific entry, or delete history:
$ pbgopy history
ID AGE TYPE SIZE LATEST PREVIEW
fcd0bc9afd9586c4544c377024d4e3b1 4s text/plain; charset=utf-8 6B * "world"
f9db4d7b8befb5d8b86b39e58b695126 9m image/jpeg 1.6MB JPEG image 3144x4192
$ pbgopy paste --id f9db4d7b8befb5d8b86b39e58b695126 >foo.jpg
The default history limit is 1, which preserves the existing latest-only behavior. Give --history-limit 0 for unlimited in-memory history.
End-to-end encryption
pbgopy comes with a built-in ability to encrypt/decrypt with a variety of keys.
With symmetric-key:
You can derive the key from password with the -p flag, which is provided so that you can encrypt/decrypt without previous setting.
pbgopy copy -p your-password <plaintext.txt
pbgopy paste -p your-password
Be aware that this way cannot prevent a dictionary attack.
For more safety, it is highly recommended to use a 32-bytes symmetric key generated by other methods.
The -k flag or the PBGOPY_SYMMETRIC_KEY_FILE environment variable is available to indicate the path to key file.
pbgopy copy -k /path/to/pbgopy.key <plaintext.txt
With public/private key-pair:
pbgopy can also encrypt using hybrid cryptosystem. If you have already exchanged public keys between devices you want to share data with, this is the way to go.
pbgopy copy --public-key-file /path/to/public.key <plaintext.txt
pbgopy paste --private-key-file /path/to/private.key <plaintext.txt
Note that you can only use an RSA key in PEM or DER format.
Via GPG
You manage your keyring in GPG? The --gpg-user-id (-u) flag is for you!
Suppose you want to encrypt with a public key whose user id is alice:
pbgopy copy -u alice <plaintext.txt
Then you decrypt it with the private key by specifying the user id on another device:
pbgopy paste -u alice
There are a couple of ways to specify a user ID. Visit here to see the entire list.
TTL
If you don't want more data to be cached on the server than necessary, use the --ttl flag to set TTL for the cache.
TTL applies to each history entry, and expired entries are not listed or pasteable.
Give 0s for disabling it. Default is 24h.
pbgopy serve --ttl 10m
Authentication
HTTP Basic Authentication is available with -a flag.
pbgopy serve -a user:pass
pbgopy copy -a user:pass <foo.png
pbgopy paste -a user:pass >foo.png
From clipboard on your OS
You can put the data stored at the clipboard on your OS into pbgopy server.
pbgopy copy -c
Command-line options
Copy
pbgopy copy -h
Copy from stdin
Usage:
pbgopy copy [flags]
Examples:
export PBGOPY_SERVER=http://host.xz:9090
echo hello | pbgopy copy
Flags:
-a, --basic-auth string Basic authentication, username:password
-c, --from-clipboard Put the data stored at local clipboard into pbgopy server
--gpg-path string Path to gpg executable (default "gpg")
-u, --gpg-user-id string GPG user id associated with public-key to be used for encryption
-h, --help help for copy
--max-size string Max data size with unit (default "500mb")
-p, --password string Password to derive the symmetric-key to be used for encryption
-K, --public-key-file string Path to an RSA public-key file to be used for encryption; Must be in PEM or DER format
-k, --symmetric-key-file string Path to symmetric-key file to be used for encryption
--timeout duration Time limit for requests (default 5s)
Paste
pbgopy paste -h
Paste to stdout
Usage:
pbgopy paste [flags]
Examples:
export PBGOPY_SERVER=http://host.xz:9090
pbgopy paste >hello.txt
pbgopy paste --id <entry-id> >hello.txt
Flags:
-a, --basic-auth string Basic authentication, username:password
--gpg-path string Path to gpg executable (default "gpg")
-u, --gpg-user-id string GPG user id associated with private-key to be used for decryption
-h, --help help for paste
--id string History entry id to paste
--max-size string Max data size with unit (default "500mb")
-p, --password string Password to derive the symmetric-key to be used for decryption
-K, --private-key-file string Path to an RSA private-key file to be used for decryption; Must be in PEM or DER format
--private-key-password-file string Path to password file to decrypt the encrypted private key
-k, --symmetric-key-file string Path to symmetric-key file to be used for decryption
--timeout duration Time limit for requests (default 5s)
History
pbgopy history -h
List clipboard history
Usage:
pbgopy history [flags]
pbgopy history [command]
Available Commands:
clear Delete all history entries
delete Delete a history entry
Examples:
export PBGOPY_SERVER=http://host.xz:9090
pbgopy history
pbgopy history --json
pbgopy history delete <entry-id>
pbgopy history clear
Flags:
-a, --basic-auth string Basic authentication, username:password
-h, --help help for history
--json Output history metadata as JSON
--timeout duration Time limit for requests (default 5s)
Serve
pbgopy serve -h
Start the server that acts like a clipboard
Usage:
pbgopy serve [flags]
Examples:
pbgopy serve --port=9090 --ttl=10m --history-limit=20
Flags:
-a, --basic-auth string Basic authentication, username:password
-h, --help help for serve
--history-limit int Number of clipboard entries to retain. Give 0 for unlimited history (default 1)
-p, --port int The port the server listens on (default 9090)
--ttl duration The time that the contents is stored. Give 0s for disabling TTL (default 24h0m0s)