![]() ![]() That gist also contains instructions for how to make the SSH reverse tunnel a default. So even if you are not behind a firewall, your port 10009 is not exposed to anyone on the Internet.Īdapted from the gist dergachev/ssh-forward-clipboard.md to work for Linux. This local loop interface only allows connections from your own machine (including, in this case, those reverse tunneled in via SSH). We do ncat -l localhost 10009 for the server, which means it listens only on the network interface with the localhost IP address. No need for xclip on the remote machine, so it works if you can't install it or can't use it because it's a headless server without X. No need to open another SSH session to the remote machine. Aliases that I used in the video:alias clip'base64 xargs -0 printf 'e52 c s007''alias blue'xargs -0 printf 'e1 34m-6sem''Link. We could call it rclip for " remote clipboard" in analogy to the well-known xclip. ssh -R 10008:localhost:10009 you want to copy a file's content from remote machine to local clipboard, execute in the SSH shell: ncat -send-only localhost 10008 < file.txtĪnd of course, that's nicer when packaged as a shell shortcut or script. (Unfortunately this can only copy as much text as fits on one screen.) Or you could just directly open your /.bashrc in whatever text editor you want. You can use that SSH session for your normal work. So with nano, the only straightforward way is to select text on the terminal using Shift+mouse or Ctrl+Shift+mouse, after which it'll become copyable using Terminator's Ctrl+Shift+C. SSH into the remote machine in such a way that a reverse tunnel is established from port 10008 of the remote machine to port 10009 on your local machine (where your server is listening). If youre copying from terminal (like if you use the cat command already posted), highlight the key details and use Ctrl + Shift + C. Or use the equivalent shorthand version: ncat -klc "xclip -sel c" localhost 10009 You can do the following that will directly copy the content of idrsa.pub to clipboard: pbcopy < /.ssh/idrsa.pub Solution 5. On your local machine, set up a server listening on the local interface that will copy content coming in on port 10009 to your X clipboard: ncat -keep-open -listen -sh-exec "xclip -selection clipboard" localhost 10009 (On your remote machine you can also do with nc or plain telnet, but on the local machine we need the options to execute commands ( -c / -e) which are not available in nc in usual distributions like Debian and Ubuntu.) apt install nmap ![]() Install ncat on your local and remote machine. Select the first item that you want to copy, and press CTRL+C. Open the file that you want to copy items from. Copying from a headless server to local clipboard, from inside your usual SSH session: Copy and paste multiple items using the Office Clipboard. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |