Tuesday, 30 July 2013

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 share 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 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 smbd 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: gksu shares-admin When prompted enter your root password. Previously in earlier tutorials I set the shares by editing the xorg.conf file, however most people would rather have a GUI to do this as it is easier. With the GUI open add your samba shares, save and exit. Note, every time you update the xorg.conf file you must restart the samba service so type: gksu service smbd restart Now we have to check the configuration so far. Type: testparm 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. Linux Clients 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: 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/(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 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. Word of warning here about firewalls. Either turn them off or add exception rules for traffic on ports 137-139 and 445.
Here at ComTech I love Linux. I use it for my own systems in the office and 'pass on the good word' to clients when appropriate. I can sort out any Linux queries you might have or offer advice if needed. Please go to http://www.comtech247.net for more information.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Us Online Casino