How to send data to local clipboard from a remote SSH session

前端 未结 11 1425
别那么骄傲
别那么骄傲 2020-12-07 07:29

Borderline ServerFault question, but I\'m programming some shell scripts, so I\'m trying here first :)

Most *nixes have a command that will let you pipe/red

11条回答
  •  孤城傲影
    2020-12-07 07:51

    Found a great solution that doesn't require a reverse ssh connection!

    You can use xclip on the remote host, along with ssh X11 forwarding & XQuartz on the OSX system.

    To set this up:

    1. Install XQuartz (I did this with soloist + pivotal_workstation::xquartz recipe, but you don't have to)
    2. Run XQuartz.app
    3. Open XQuartz Preferences (kb_command+,)
    4. Make sure "Enable Syncing" and "Update Pasteboard when CLIPBOARD changes" are checked XQuartz Preferences window example
    5. ssh -X remote-host "echo 'hello from remote-host' | xclip -selection clipboard"

提交回复
热议问题