On the Net

|Main Blog|Yearning|  

Words of God


About Linux News and OpenSource




and below are my posts....


Tuesday, March 07, 2006

SAMBA File Server - Quick how-to

The scenario: I have a Centos 4.2 PC that serves as file storage from 3 Windows XP client.

Assuming that samba server package has been already installed, and the only thing that we would like to do is to configure or edit the file /etc/samba/smb.conf.

A simple anonymous Samba File server

- Create a directory that everyuser has access into. Say.. shared is the directory to be created under /home, so the command would be "mkdir -m 777 /home/shared".

- Now we have to configure Samba for anon access, but first we have to back-up the original smb.conf file. Doing "mv /etc/samba/smb.conf /etc/samba/smb.conf.orig" will change the the file from smb.conf to smb.conf.orig. Then "vi /etc/samba/smb.conf" and enter the following below:

#/etc/samba/smb.conf
[global]
workgroup = homebox
netbios name = fileserver
server string = anonymous file server
security = share
browseable = yes
hosts allow = 192.168.1.

[share1]
path = /home/shared
comment = shared-folder
read only = No
guest ok = Yes

Now, to apply it in your network, just replace the workgroup entry to your existing workgroup and host allow entry. You might have different IP address on your existing PC.

Now check by the command "testparm", if configured correctly, there will be no errors, else, check the config or typo mistakes.

Check if samba-server runs on start-up, "chkconfig --list | grep smb"

smb 0:off 1:off 2:on 3:off 4:on 5:on 6:off

It shows that samba runs upon booting on init 3 and init 5, but if not, you can just issue the command "chkconfig --level 3 smb on" and upon booting to level 3, samba also start.

Or we can start the service manually, when as root, do the command "/etc/init.d/smb start"

Now, browse the Network Neighborhood on your windows XP and check if you can read/write on the shared folder on Samba Server.

Adding authentication to samba server

Edit /etc/samba/smb.conf and it sould be similar to the file below

#/etc/samba/smb.conf

[global]
workgroup = homebox
netbios name = fileserver
server string = file server
security = user
encrypt password = yes
browseable = yes
hosts allow = 192.168.1.

[share1]
path = /home/shared
comment = shared-folder
read only = No


Then create a samba user and password file, do the command as root:

# smbpasswd -a sambauser
New SMB password:
Retype new SMB password:
Added user sambauser.


Note: sambauser should exists as a regular user on the server, unless if you have a separate authentication server like that of NIS or LDAP.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home