如何从在远程ssh连接上运行的tmux(复制模式)复制到本地剪贴板 [英] How do you copy from tmux (copy mode) running on a remote ssh connection to your local clipboard

查看:508
本文介绍了如何从在远程ssh连接上运行的tmux(复制模式)复制到本地剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过OS X上的VirtualBox运行linux.我通过在无头状态下运行我的VM,然后使用端口转发将其切入Linux机器来实现此目的.现在,无论将什么复制到虚拟机上的剪贴板中,我都可以粘贴到远程ssh会话中,反之亦然(从tmux复制模式复制).我尝试使用以下tmux配置:

I run linux via VirtualBox on OS X. I do this by running my VM in a headless state and then sshing to the linux machine using port forwarding. Right now whatever is copied to my clipboard on my virtual machine I am able to paste on my remote ssh session, but not vice versa (copying from tmux copy mode). I have tried using the following tmux configurations:

setw -g mode-keys vi
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "tmux save-buffer - | ssh host pbcopy"

不幸的是,这不起作用...使用鼠标手动复制可以工作,但是tmux复制模式更方便.有什么想法吗?

Unfortunately this is not working... Manually copying using my mouse works but tmux copy mode is more convenient. Any ideas?

推荐答案

这需要将tmux缓冲区与OSX剪贴板集成在一起.您正在尝试使用ssh host pbcopy进行此操作,但我认为您的设置不正确.

This needs integrating tmux buffers with OSX clipboard. What you are trying to do with ssh host pbcopy is just that but I don't think your setup is correct.

host应该是您的本地OSX计算机.而且,您应该在运行tmux的OSX用户名和远程用户之间建立无密码的基于密钥的信任.

host here should be your local OSX machine. And you should have password less key-based trust established between your OSX username and remote user where you are running tmux.

第1步.在OSX上启用SSH 转到System preferences -> Sharing并启用Remote Login.另外,从列表中删除管理员并添加您的用户名.

Step 1. Enable SSH on your OSX Goto System preferences -> Sharing and enable Remote Login. Also remove administrators from the list and add your username.

第2步.设置密码少的登录名.
这些是步骤

Step 2. Setup password less login.
These are the steps

第3步.host替换为192.x.x.x或从Virtualbox可以访问的任何OSX ip地址.

Step 3. Replace your host with 192.x.x.x or whatever your OSX's ipaddress is which is reachable from your Virtualbox

这篇关于如何从在远程ssh连接上运行的tmux(复制模式)复制到本地剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆