20

我正在使用 Mac,并且在虚拟机上安装了 debian linux。我想将一个 URL 从我的 Mac 复制到虚拟框中的终端 linux。我怎样才能做到这一点?

4

6 回答 6

40

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

于 2013-04-29T16:44:08.773 回答
9

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

于 2012-12-21T07:54:59.140 回答
6

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

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

于 2013-08-24T15:11:28.787 回答
2

首先
安装 Guest Additions CD ( Devices->Insert Guest Additions CD image)。

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

Change VirtualBox Host Key
InVitualbox/Preferences/Input/Virtual Machine/Host Key Combination
选择不同的然后⌘</kbd>

键映射
对于cmd/ctrl我来说添加英文(Macintosh)键盘的映射似乎是最舒服的解决方案:)

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

我在 VirtualBox 5.0.4 中的 Ubuntu 14.04.3 LTS 64bit

于 2015-09-12T13:31:33.280 回答
2

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

简短的版本是您可以使用 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

该脚本对于破解愚蠢地阻止粘贴的密码字段也很有用。

于 2016-08-10T05:13:24.073 回答
1

我在我的 windows 机器上使用 ubuntu,virtualbox 与 PuTTY、FileZilla 等连接。

(不使用默认的 virtualbox 控制台)

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

### 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 Files\Oracle\VirtualBox\VBoxManage.exe" startvm "UbuntuMin" --type headless
    "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "UbuntuMin" poweroff
    Add shortcuts to start menu -> ubuntu START & STOP - change .ico - right click - pin to start
于 2017-08-22T11:38:04.957 回答