How to Set Up and Configure Samba

How to Set Up and Configure Samba




The following tutorial will show you how to set up samba on a Linux system allowing you to proportion files and folders with either a Linux or a Windows client. All the following steps work on Linux Mint 11 but should also work on any other dispensing using gnome. For kde the only thing which differs is defining shares (usually by the kde control center).

On the Samba Server

First thing is to check samba is installed. Open up a terminal and kind:

sudo apt-get install smbd

kind your root password when prompted. Then install smbfs by typing:

sudo apt-get install smbfs

and then kind 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 example 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 stated in the smbpasswd file will be able to access your samba shares. Open a terminal as root and kind:

smbpasswd -a user (where user is the name of the person allowed to access the shares). When prompted go into their new password twice.

Next we have to define the samba shares. kind:

gksu shares-admin

When prompted go into your root password. With the GUI open add your samba shares, save and exit.

observe, every time you update the smb.conf file you must restart the samba service so kind:

gksu service smbd restart

Now we have to check the configuration so far. kind:

testparm

If there are errors in the smb.conf file testparm will tell you. If everything is OK then kind:

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 obtainable samba shares. At this point if you have no errors your server is configured correctly.

Linux Clients

Install smbclient and smbfs either using the package manager or apt-get install. Now we have to mount the obtainable shares. First decide where you are going to mount them. I will mount them in /media/dev/proportion but first I will have to make the directory dev so:

cd /media

gksu mkdir dev

and then ls which should show us the new dev directory in media. Now time to mount the shares.

gksu mount -t smbfs //192.168.1.10/(proportion name) /media/dev/proportion

where 192.168.1.10 is the ip address of your samba server. This will mount the proportion but only as long as you are logged in. To make the link persistent you need to go into the following line into /etc/fstab.

//192.168.1.10/(proportion) /media/dev/proportion cifs username=user,password=pass,user,rw,noatime 0 0

Windows Clients

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.

information of warning here about firewalls. Either turn them off or add exception rules for traffic on ports 137-139 and 445.




leave your comment

Search

Top