[sysadmin tip] VirtualBox - forget about "shared folders" use SSH

Quick way to access host directories from guest.
I assume you are running Linux on both host and guest.

1. OpenSSH server must be installed and running on host machine.

To install:

yay -S openssh

To start it now and enable it in autostart

sudo systemctl enable --now sshd

2. Start virtual machine (guest)

3. Check host IP

On host find IP which we will use to connect from guest:

ip a | grep "inet "
    inet 127.0.0.1/8 scope host lo
    inet 192.168.42.106/24 brd 192.168.42.255 scope global dynamic noprefixroute enp0s16f1u1

in this case IP is: 192.168.42.106

4. Connect from guest to host

PCManFM obviously supports SSH connections – like any other Linux file manager.

To connect, just type in the address bar:

ssh://USER@HOST_IP/remote/directory

For example:

ssh://napcok@192.168.42.106/home/napcok

Of course, you can keep such a connection in bookmarks

That’s all. Fast, convenient, flexible.

No need to bother with usergroups, headers, modules and kernel versions.

6 Likes

This is a really useful tip. I have been using Virtualbox for years to evaluate distributions and never even considered ssh.

Thank you Napcok, :+1:

1 Like