如何使用Mac键盘粘贴到虚拟框中的终端Linux



我正在使用Mac,并且我已经在Virtual Box上安装了debian linux。我想将 URL 从我的 Mac 复制到虚拟框中的终端 linux。我该怎么做?

有时,在Mac上打开终端然后通过SSH连接到VirtualBox来宾会更容易。 这避免了很多改变焦点等的麻烦。

我刚刚遇到了同样的问题。 确保剪贴板共享已打开后,按 Ctrl+Shift+V 粘贴到 debian 中的终端中。

我刚刚写了一个指南,在VirtualBox上在OS X和Ubuntu之间复制和粘贴工作,因为它一直让我感到沮丧。也许对遇到这个问题的人有帮助:

http://blog.nostopbutton.com/2013/08/24/setup-copy-and-paste-between-os-x-and-linux-virtualbox/

First
安装客户机添加 CD ( Devices->Insert Guest Additions CD image )。

激活剪贴板共享
然后在重新启动后,在Virtualbox中转到Machine->Settings->General->Advanced并设置
Shared Clipboard: Bidrectional

更改虚拟盒子主机密钥
Vitualbox/Preferences/Input/Virtual Machine/Host Key Combination
选择不同的然后

按键映射
对于我的cmd/ctrl映射,添加英语(Macintosh)键盘似乎是最舒适的解决方案:)

转到Ubuntu Settings->Text Entry
(我想在旧版本中它可能在键盘布局设置中)
Input sources to use:下命中加号 (+)
添加English (Macintosh)

我在 Ubuntu 14.04.3 LTS 64 位上,在 VirtualBox 5.0.4 中

我整理了一个描述如何做到这一点的页面

简短的版本是您可以使用AppleScript和自定义键盘快捷键执行此操作。

苹果脚本:

on run {input, parameters}
    set input to input as text
    tell application "System Events"
        repeat with currentChar in the characters of input
            set cID to id of currentChar
            set used to false
            repeat with r in {{48, 29}, {49, 18}, {50, 19}, {51, 20}, {52, 21}, {53, 23}, {54, 22}, {55, 26}, {56, 28}, {57, 25}, {45, 27}, {46, 47}, {47, 44}, {61, 24}}
                if first item of r is equal to cID then -- 0-9 -./=
                    key code (second item of r)
                    set used to true
                end if
            end repeat
            repeat with r in {{42, 28}, {43, 24}} -- *+
                if first item of r is equal to cID then
                    key code (second item of r) using shift down
                    set used to true
                end if
            end repeat
            if not used then
                keystroke currentChar
            end if
        end repeat
    end tell
    return input
end run

此脚本对于击败愚蠢地阻止粘贴的密码字段也很有用。

我从我的Windows机器上使用ubuntu,virtualbox与PuTTY,FileZilla等连接。

(不使用默认的虚拟盒控制台)

以下是从头开始设置的方法:

### Setup Virtualbox:
    https://www.virtualbox.org/wiki/Downloads
    install ubuntu from their website
### Launch Ubuntu from Virtualbox Console:
    sudo apt-get install openssh-server
    sudo systemctl start ssh
    sudo systemctl status ssh
    netstat -tulpn
        # see ubuntu port 22 open and ssh running
    sudo poweroff
### Virtualbox: 
    settings - network - Advanced - Adapter Type: PCNet Fast 3 - Port Forwarding
    Name: SSH, Protocol: TCP, Host Port (Windows): 3022, Guest Port (Ubuntu): 22
    right click - start - headless start
### PuTTY: 
    Seesion: Localhost Ubuntu: <your_user> -p
        Host: <your_user>@127.0.0.1
        Port: 3022
    Window - Colums: 130, Rows: 24
    Scrollback lines: 10000
    Appearance - Cursor: Vertical + Blinks
    Font Courier New  - Regular - 12px
    Behaviour - Window Title: Localhost Ubuntu
    Full screen on ALT + ENTER
    Connection Data - Auto login Username: <your_user>
    Session - SAVE!
### FTP:
    Host: localhost 
    Port: 3022
    SFTP (SSH FTP)
    Logon Type: normal
        <your_user>
        <pass>
    Transfer settings: limit max. conenction: 4
### Git BASH:
    ssh -p 3022 <your_user>@localhost
### Enable SSH Root Login: (Use only on localhost, security advice!)
    # Set a password for root account first and then enable root account:
        sudo passwd root
        sudo passwd -u root
        # Reverting Back: (lock the root account)
            sudo passwd -l root
    # Enable SSH root login:
        sudo nano /etc/ssh/sshd_config
            # PermitRootLogin prohibit-password
            PermitRootLogin yes
        sudo systemctl restart ssh
### Virtualbox Windows Headless Start
    # Make a .lnk shortcut with target or .bat batch file
    "C:Program FilesOracleVirtualBoxVBoxManage.exe" startvm "UbuntuMin" --type headless
    "C:Program FilesOracleVirtualBoxVBoxManage.exe" controlvm "UbuntuMin" poweroff
    Add shortcuts to start menu -> ubuntu START & STOP - change .ico - right click - pin to start

最新更新