Creating a Samba share between Ubuntu and Mac OS X
On the project I’m currently working on we have our development environment setup on a bare bones Ubuntu instance which we run via VmWare.
We wanted to be able to edit files on the VM from the host O/S so my colleague Phil suggested that we set up a Samba server on the VM and then connect to it from the Mac.
We first needed to install a couple of packages on the VM:
-
apt-get install samba
-
apt-get install libpam-smbpass
The first package is self explanatory and the second allows us to keep the samba username/password in sync with the unix user on the VM.
Installing the samba package will automatically start up the Samba daemon 'smbd'.
$ ps aux | grep smbd
mneedham 10915 0.0 0.0 7624 928 pts/14 S+ 17:37 0:00 grep --color=auto smbd
root 32610 0.0 0.1 95372 5408 ? S Jun22 0:50 smbd -F
We then need to edit /etc/samba/smb.conf:
First we uncomment this line:
security = user
Then add a share, probably at the bottom of the file but anywhere is fine:
[mneedham]
comment = Mark's vm
read only = no
path = /home/mneedham
guest ok = no
browseable = yes
create mask = 0644
From the Mac we need to mount the share:
-
Go to finder
-
Connect to server (Cmd - K)
-
Type in 'smb://ip.of-vm
-
Select the name of the share
The share should now be accessible from the host O/S at /Volumes/name.of.share
Looking back I’m sure there’s a way to configure VmWare to share files from the guest O/S but at least I now know another way to do it as well!
About the author
I'm currently working on short form content at ClickHouse. I publish short 5 minute videos showing how to solve data problems on YouTube @LearnDataWithMark. I previously worked on graph analytics at Neo4j, where I also co-authored the O'Reilly Graph Algorithms Book with Amy Hodler.