Friday, February 26, 2010

Create a Public Share on Samba

SkyHi @ Friday, February 26, 2010

The goal of this tutorial is to show you how to set up a public share on your Samba server that can be used by everyone on your network with all rights. This will enable everyone on a Windows machine to access this without a password.  Of course, this has security implications but it is a good way to get something working.  The next article will show you how to create a share for one user in which that one user is the only one who can access the share.

1. Install Samba
yum install samba samba-client samba-common

chkconfig  – -level 35 smb on

service smb start

2. Create a New smb.conf file

First,  change the  default smb.conf file to a backup copy, and then create a whole new one.

# mv smb.conf smb.conf.backup
# vim smb.conf

Here’s the new smb.conf file:
Note the workgroup should be the workgroup that you are using on your Windows machines.

[global]
netbios name = linuxserver
workgroup = WORKGROUP
server string = Public File Server
security = user
map to guest = bad user
guest account = smbguest

[public]
path = /public
guest ok = yes
read only = no

3. Test with testparm
This will help you determine if you have any major problems with the set up you placed in smb.conf.

# testparm
Load smb config files from /etc/samba/smb.conf
Processing section “[public]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
server string = Public File Server
map to guest = Bad User
guest account = smbguest

[public]
path = /public
read only = No
guest ok = Yes

4. Create a public user
Since the purpose is to  map the users to a special guest account,  open the /etc/passwd file for editing, and add the following line to the end of the file.

smbguest:x:525:525:Samba Guest Account:/dev/null:/bin/false

This creates the guest account.  Now, create a smbguest group with a group ID, here the GID of 525 was used, it does not matter which number as long as it is not used and over 500.

# groupadd -g 525 smbguest

Now, change to the root of the file system, and create the new directory that  to share.

# mkdir public

# chown -R smbguest:smbguest public

# ls -l
drwxr-xr-x 2 smbguest smbguest 184 2007-08-03 15:18 public

5. Access the share from Windows
Once you create public folder it should be visible on the network from an XP machine.

Expand “My Network Places”, and then expand “Workgroup”.  You’ll then see all of the members of the workgroup that’s named “Workgroup”.  Note also that you can have other workgroups with different names.  Even though a Windows computer can only be a member of one workgroup at a time, Windows Explorer will still show all workgroups that are on the network.


REFERENCE

http://beginlinux.com/blog/2010/01/create-a-public-share-on-samba/