Sharing files and folders from Ubuntu to Mac OS X

This article tries to explain, step by step, how to set-up Ubuntu Linux to share files and folders with Mac OS X in an heterogeneous network. The goal is to be able to read and write files from a Mac computer running Mac OS X into another one running Ubuntu Linux.
Requirements
A computer running Ubuntu. In order to perform this installation you can read the Ubuntu installation guide in this same Web Site.
A Mac computer. Any model running Mac OS X.
A local area network with Internet connection.
Setting up shared folders
First of all we have to set up the folders we want to share. To accomplish this task select the option "Shared folders" from the "Administration" menu.

Ubuntu may ask for a superuser account, in that case write the password for the current user and click "Ok".

Once user validated a list of options appear for shared folders. We have to activate "Install Windows networks support (SMB)" option and deactivate "Install Unix networks support (NFS)".

In the following dialogue click "Add" button to browse the folders you want to share.

For each folder one can set the name they will be identified by in the network, a comment and if the folder is for read only purposes. In our case deactivate the option "Read only" in order to allow write access to the folder.

When all the folders you want to share are in the list, click "Close".

Next we have to change some settings in order to make it even easier Mac OS X configuration. One is to change the work group name to "WORKGROUP", because this is the default name in Mac OS X. Second is to change access control method to give some security features on sharing files. All this is done using the console. Open it from "Applications->Accessories" and "Terminal" option.

At the system prompt write the command
sudo gedit /etc/samba/smb.conf
it may ask for superuser rights (remember you must use the current user password)

This will open "Gedit" application that allows us to edit text files. Go to line where work group name is defined and change "MSHOME" to "WORKGROUP".

we also have to uncomment the line where security method is defined. Simply drop the ";" from the beginning of the line, leaving the rest of the line as it is. Close the program "Gedit" saving changes.

In order to activate the changes made, we must restart the Samba service. It can be done with the following command
sudo /etc/init.d/samba restart

Once service started, create the Samba user with the command
sudo smbpasswd -a david
the name of the user "david" in our case, is the same user name as the Ubuntu Linux user we are logged in. We recommend you to do it the same way.

At this point, the Samba service configuration and the shared folders are available in our network.
Ubuntu network configuration
To make shared folders easy to locate in our network and given that we don't have a DNS server running, we define a fixed IP for our Ubuntu host. This way we can give the name Ubuntu to that IP and search by computer name in the network.
Choose "Network" from "System->Administration" menu.

The network configuration dialogue appears. Select the network interface and click "Properties". In the properties dialogue choose "Static IP address" and give the machine IP, the network mask and your gateway IP (192.168.1.1 the router in our case).

Accept the changes made and wait till the network configuration is refreshed and active. This is a good moment to test the network configuration, accessing Internet with the browser for example, and check that everything is OK.
Mac OS X network configuration
Assuming that your Mac computer is already configured in the same network as the Ubuntu host, we proceed to set the name of the Ubuntu host and IP.
Run "NetInfo Manager".

Choose "machines" and "localhost" in it. Once selected click on "Duplicate" button to create an exact copy. Then change the "ip_address" and "name" values as you can see in the image.

Close "NetInfo Manager" and from "Finder choose "Go->Connect to ...". A dialogue appears where we have to write the name of the shared resource
smb://ubuntu/david (protocol samba, host ubuntu and shared resource david).

It asks for user and password (in our case the same as for Ubuntu).

You got it. Access to shared folder with read and write privileges on Ubuntu shared folder from Mac OS X is available in your network.

Thanks
If you don't want to deal with users and passwords change security = user to security = share
Thanks! ¡Gracias!
Thank you so much for the great info. Had just one share that didn't want to work (another was working fine), but this fixed the problem in no time!
Muchísimas gracias por la excelente info. Tuve un share que no quería funcionar (otro funcionaba bien), ¡pero esto resolvió el problema en poco tiempo!
Do you have a solution that
Do you have a solution that works in Leopard?
No special considerations to make it work in Leopard
I have to say that Leopart has improved discovering computers on heterogeneous networks. For example, configuring SAMBA on a SuSE server is very easy. We got one SuSE server on our LAN and my Macbook with Leopard can see the SuSE server in Finder without any configuration needed.
Post new comment