Setup a LAMP Stack with Mac/VirtualBox/Ubuntu - Part 3 of 4 - Access Guest From Host

1st Oct, 2016 | Environments | Read Time: 3 mins

In the first article, you learned how to install Ubuntu in VirtualBox. In the second article, you setup the LAMP stack with Apache, MySQL and PHP. In this third article, we will configure Ubuntu to allow terminal and Finder access from your Mac using OpenSSH and Samba.

Table of Contents

Install OpenSSH

Once again, let's emulate 'superuser' so we don't have to keep typing 'sudo' before every command. Go ahead and open up the Terminal and enter the following command:

sudo su

This will install OpenSSH and create a backup of the configuration file:

apt install openssh-server
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
chmod a-w /etc/ssh/sshd_config.factory-defaults

You can now make changes to the config file. Since it will work without making changes, that is outside the scope of this article. For more information about configuring OpenSSH, see SSH/OpenSSH/Configuring in the Ubuntu Community Help Wiki.

Once you finish making changes to the config file, restart OpenSSH:

service ssh restart

In order to SSH into guest from host, we need the guest's IP address. In the terminal, enter:


Find The Guest IP Address

In this example, you can see the guest IP address is

Now switch over to your host, open the terminal and enter:

ssh mydev@

SSH Into Guest from Host

You'll be prompted for mydev's password which is whatever you set your password to when installing Ubuntu in the 'Who are you?' section in Part 1.

Install Samba

This will install Samba with dependencies. Go back to your Ubuntu terminal and enter the following commands:

apt install gksu samba samba-common system-config-samba cifs-utils
touch /etc/libuser.conf
service smbd restart

Note: "touch /etc/libuser.conf" is a workaround for a bug that causes an error " fails to start" and has been reported in Launchpad.

Now open up the Samba application and create a new user:

  1. Set 'Unix Username' and 'Windows Username' to "mydev".
  2. Set the passwords to whatever you set your password to when installing Ubuntu in the 'Who are you?' section in Part 1.

Create Samba User

Next add a new Samba Share by clicking the big green plus sign. In the Basic tab:

  1. Select the /var/www 'Directory'.
  2. Set the 'Share Name' and 'Description' as "www".
  3. Check 'Writable' and 'Visible'

Samba Share Basic Settings

In the Access tab:

  1. Check "mydev" as the specific user to allow access.
  2. Click OK.

Samba Share Basic Settings

You should now see it listed in the Samba Server Configurations:

Samba Share Basic Settings

Now switch over to your host and open Finder. We're going to connect to your guest:

  1. From the Finder menu, select Go -> Connect to Server....
  2. Enter a new server address "smb://mydev" and click the + button to add it to your favorites.
  3. Select your new server and click Connect.

    Connect to Server

  4. You'll be prompted to login:

    • Select 'Registered User'.
    • Set 'Name' as "mydev".
    • Set the 'Password' to whatever you set the Samba user up with.
    • Check 'Remember password'.
    • Click Connect

    Login to Server

  5. Next select the 'www' volume to mount it and click OK.

    Select www Volume

You now have access to the www folder on guest from your host!

Browse www Directory

Next, we'll make some tweaks to Ubuntu to make it more useful as a development environment.

Full Tutorial Table of Contents

Part 1: Installation

Part 2: Setup LAMP Stack

Part 3: Access Guest From Host

Part 4: Ubuntu Customization


Leave a comment

Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`
The error has been logged in /anchor/errors.log
Uncaught Exception

Uncaught Exception

Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`


anchor/routes/site.php on line 280


#0 [internal function]: System\Error::shutdown()
#1 {main}