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
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:
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:
In this example, you can see the guest IP address is 192.168.56.103.
Now switch over to your host, open the terminal and enter:
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.
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 "system-config-samba.py fails to start" and has been reported in Launchpad.
Now open up the Samba application and create a new user:
- Set 'Unix Username' and 'Windows Username' to "mydev".
- Set the passwords to whatever you set your password to when installing Ubuntu in the 'Who are you?' section in Part 1.
Next add a new Samba Share by clicking the big green plus sign. In the Basic tab:
- Select the /var/www 'Directory'.
- Set the 'Share Name' and 'Description' as "www".
- Check 'Writable' and 'Visible'
In the Access tab:
- Check "mydev" as the specific user to allow access.
- Click OK.
You should now see it listed in the Samba Server Configurations:
Now switch over to your host and open Finder. We're going to connect to your guest:
- From the Finder menu, select Go -> Connect to Server....
- Enter a new server address "smb://mydev" and click the + button to add it to your favorites.
Select your new server and click Connect.
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
Next select the 'www' volume to mount it and click OK.
You now have access to the www folder on guest from your host!
Full Tutorial Table of Contents
Part 1: Installation
- Why Use VirtualBox?
- Host and Guest
- Download and Install the Necessary Software
- Create a New Virtual Machine in VirtualBox
- Modify Virtual Machine Settings
- Install Ubuntu
Part 2: Setup LAMP Stack
- Install Apache
- Install MySQL 5.7
- Install PHP 7
- Restart Apache
- Prepare the WWW Directory
- Install phpMyAdmin