Tuesday, March 15, 2011

HOWTO: Setting up an SMB share on Debian Squeeze

I needed to set up a Windows share on my new Debian box since I want it to be a file server for both Windows and Linux clients.   In addition, I wanted the server to be somewhat secure by requiring password access.  In this case, I set up a single shared directory and don't care about sharing /home directories.


1.Make sure you have the necessary packages installed.  This will already be done if you selected file server in the Debian installation menu.

sudo apt-get install smbfs samba
2.In your /etc/samba/smb.conf file, make the following changes:

 Make sure you have "security = user" in there and uncommented.  It may be set to security = share by default.

In your "Share Definitions" section, set up a new share similar to the following:

   comment = Guest access Share
   path = /mnt/primary
   writeable = yes
   valid users = @smb
   guest ok = no

This says that the share will be called "primary", the local path to the share directory is at /mnt/primary, authorized users can write, only users in the group smb are allowed, and anonymous guests cannot use this.

When you are done, save the file.  Then run testparm to see if there are any problems.  Lastly, restart the samba server with  /etc/init.d/samba restart.

3.Client Setup
On windows, choose map network drive from the "My Computer" screen.  Then enter \\debian_box_ip_address\share_name  eg: \\\primary.  Then choose "login with different credentials" and enter your Linux  username/password.  Have fun.

Next I will cover nfs access.  NFS is what you will want to use for Linux client access.

No comments: