Wednesday, December 29, 2010

SMB -- Provide network shares to specific clients

Setting up samba is always fun. Laden with landmines between the Windows and Linux world, everytime you think you have a working solution, it flakes out on you. Here are the steps needed to add an SMB share to specific clients.
  1. Install samba 
    1. yum install samba-client samba-common samba
  2. Configure the /etc/samba/samba.conf file
    1. Find the line workgroup and set the correct workgroup name
    2. At the end of the file, create a new directory block using the same syntax as the others. This example will create a share named "foo" that is only accessible by user "foo"
      1. # foo
      2. [foo]
      3. path = /foo
      4. writeable = yes
      5. browseable = yes
      6. valid users = foo
  3. Save the file and restart the services -- service smb restart, service nmb restart
  4. Make sure the user "foo" exists, and set the samba password - smbpasswd -a foo


Anonymous said...

Don't forget to enable selinux context for any samba (cifs) shares that you create on Linux. If not, then it may be difficult for the client to successfully mount the samba share.

Anonymous said...

As far as the "specific clients" part goes, you may need to restrict the share to specific hosts. In the share section, add a line like the following:

hosts allow = 192.168.7.

This would allow hosts in the range to connect to that share, but block any other connections to that share (but still allow them to other shares). Good luck on the retake!