Today I will show you how to share files on Ubuntu 12.10. I will be using the desktop version of Ubuntu 12.10 so this tutorial will not work on the server variant (later tutorials will cover that).
The first thing we need to do is to install the packages we need so open up a terminal and type:
sudo apt-get install samba4
Type your root password when prompted. Then install cifs-utils by typing:
sudo apt-get install cifs-utils
and then type your root password again.
Now that the required software is installed we can configure it so in your terminal type:
sudo gedit /etc/samba/smb.conf
In the configuration file locate the line WORKROUP = WORKGROUP and change it to the name of your network. So for instance mine would be changed to WORKGROUP = Home_Network1.
Save the file and exit.
It is now time to add users who will be able to access the shared files and we do this by using the smbpasswd file. Only users specified in the smbpasswd file will be able to access your samba shares and only users who have users accounts on the system can be added. In your terminal type:
sudo smbpasswd -a user (where user is the name of the person allowed to access the shares)
When prompted enter their new password twice. If more than one user is allowed to access the share repeat the process.
Now we need to share some files so click Dashboard (top left) and type Samba to open up the file sharing GUI.
Click on the Add sign to get the following screen.
Choose which directory you would like to share and give it a share name. Make sure that you tick both Writable and Visible (shown above).
On the Access tab you can choose which users are able to access the shares. Click on the user (or users) you added to smbpasswd earlier.
After you do configuration changes in samba you have to restart the service so in a terminal type:
sudo service samba4 restart
Now we have to check the all the configuration files so in your terminal type:
Testparm will tell you if there are any errors in your configuration. If everything is Ok then type:
smbclient -L 10.0.0.151 (where 10.0.0.151 is the ip address of your samba server).
This will show you the list of all your available samba shares. At this point if you have no errors your server is configured correctly.
How to connect to your shared files
On Linux Clients:
Install samba and cifs-utils either using the package manager or the terminal. We need to edit the Workgroup field in smb.conf to the name of your network (e.g Home_Network1).
Then we have to mount the available shares. First decide where you are going to mount them. I will mount them in /media/dev/share but first I will have to make the directory dev so:
sudo mkdir dev
and then ls which should show us the new dev directory in media. To mount the shares at boot you will need to add the following line to /etc/fstab
//10.0.0.155/(share) /media/dev/share cifs username=user,password=pass,user,rw,noatime 0 0
On Windows Clients:
We have to change the workgroup to Home_Network1 and then add the ip address of the samba server to the hosts file (must open as administrator).
Once this is complete map the shares to your computer.
Word of warning here about firewalls. Either turn them off or add exception rules for traffic on ports 137-139 and 445.
About the Author
Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients in and around Stirling.
For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more.