The following tutorial will show you how to set up samba on a Linux system allowing you to share files and folders with a either a Linux or a Windows client. All the following steps work on Linux Mint 11 but should also work on any other distribution using gnome. For kde the only thing which differs is defining shares (usually through the kde control center).
On the Samba Server
First thing is to check samba is installed. Open up a terminal and type:
sudo apt-get install samba
Type your root password when prompted. Then install smbfs by typing:
sudo apt-get install smbfs
and then type your root password again.
Now open up your smb.conf file by typing:
gksu gedit /etc/samba/smb.conf
Locate the line WORKROUP = WORKGROUP and change it to the name of your network. So for instance mine would be changed to WORKGROUP = MINT_HOME. Save the file and exit.
Now we have to add users to the smbpasswd file which is located at /etc/samba/smbpasswd. Only users specified in the smbpasswd file will be able to access your samba shares. Open a terminal as root and type:
smbpasswd -a user (where user is the name of the person allowed to access the shares). When prompted enter their new password twice.
Next we have to define the samba shares. Type:
With the GUI open add your samba shares, save and exit.
Note, everytime you update the smb.conf file you must restart the samba service so type:
sudo service smbd restart
Now we have to check the configuration so far. Type:
If there are errors in the xorg.conf file testparm will tell you. If everything is Ok then type:
smbclient -L 192.168.1.10 (where 192.168.1.10 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.
Install smbclient and smbfs either using the package manager or apt-get install. Now 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. Now time to mount the shares.
sudo mount -t smbfs //192.168.1.10/(share name) /media/dev/share where 192.168.1.10 is the ip address of your samba server. This will mount the share but only as long as you are logged in. To make the link persistent you need to enter the following line into /etc/fstab.
//192.168.1.10/(share) /media/dev/share cifs username=user,password=pass,user,rw,noatime 0 0
We have to change the workgroup to MINT_HOME 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 the owner of ComTech. I provide IT Support, Laptop repairs and Computer repairs to both personal and business 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 my blog, testimonials, services and much more. Start supporting a local business today so I can start supporting you.
If you found this blog useful then why not sign up to my RSS Feed for news, tutorials, views and general techie stuff!!