Share a Folder between Ubuntu 18.04 Host and a MacOS High Sierra Guest in VirtualBox

Share a Folder between Ubuntu 18.04 Host and a MacOS High Sierra Guest in VirtualBox


No alt text provided for this image

If you followed this article about hosting a MacOS High Sierra in VirtualBox you would face a big problem:

How can I move data between the Ubuntu Host and MacOS Guest operating systems?

Samba to the rescue!

We can install Samba on Ubuntu like this:

$ sudo apt update

$ sudo apt install samba

Now that Samba is installed, we need to create a directory for it to share:

$ mkdir /home/<username>/sambashare/

The command above creates a new folder sambashare in our home directory which we will share later. The configuration file for Samba is located at /etc/samba/smb.conf. To add the new directory as a share, we edit the file by running:

sudo nano /etc/samba/smb.conf

At the bottom of the file, add the following lines:

[sambashare]
    comment = Samba on Ubuntu
    path = /home/username/sambashare
    read only = no
    
    browsable = yes 

Then press Ctrl-O to save and Ctrl-X to exit from the nano text editor.

Now that we have our new share configured, save it and restart Samba for it to take effect:

sudo service smbd restart


Update the firewall rules to allow Samba traffic:

sudo ufw allow samba


Connection in MacOS

Fire up Finder in your MacOS:

No alt text provided for this image

Now press Command(Windows)+K to open Connect to Server window and type:

smb://<your Ubuntu IP Address>

You can see the IP address in Ubuntu using "ifconfig" command.

No alt text provided for this image

After that enter the password for your Samba user and you're good to go.


要查看或添加评论,请登录

社区洞察

其他会员也浏览了