Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Samba Fileserver With SWAT On Fedora 8


This document describes how to set up and configure a Samba fileserver on Fedora 8 with the Samba Web Administration Tool (SWAT). The resulting system provides an easy to use fileserver for your Windows network.

This howto is a practical guide without any warranty – it doesn’t cover the theoretical backgrounds. There are many ways to set up such a system – this is the way I chose.

 

1 Preliminary Note

I used a minimal Fedora 8 installation without GUI etc for this howto. Additionally I had to deinstall Firefox after the minimal installation.

  • Hostname: server1.example.com
  • IP: 192.168.0.100

 

2 Preparation

2.1 Yum

First we install some packages to speed up yum and prevent problems with packages.

yum install yum-fastestmirror yum-skip-broken

 

2.2 SELinux

SELinux should be disabled. If you’re not sure if it is disabled enter:

cat /etc/selinux/config | grep ^SELINUX=

Disable SELinux if it is enabled:

vi /etc/selinux/config

Set

SELINUX=enforcing

to

SELINUX=disabled

Afterwards reboot the system:

reboot

 

2.3 Update

Time to update your system:

yum update

 

3 Samba

Now we install Samba and the Samba Web Administration Tool.

yum install samba samba-swat

 

4 Basic Configuration

4.1 Firewall

We have to open a few ports so that the clients can connect to Samba:

system-config-firewall-tui

firewall1

Set Samba as a trusted service.

firewall2

4.2 Xinetd

If you set up a server without GUI you have to add an additional IP to the swat configuration to use the swat-webinterface.

vi /etc/xinetd.d/swat

Change

only_from = 127.0.0.1

To

only_from = 127.0.0.1 %additional_ip%

 

4.3 Services

Now we enable the automatic startup of the needed services.

chkconfig smb on
chkconfig nmb on
chkconfig swat on

Afterwards reboot the system.

reboot

5 Adding And Managing Samba Shares

Connect to swat with your preferred browser.

http://%host_ip%:901

E.g.:

http://192.168.0.100:901

The swat webinterface appears:

swat1

5.1 Preliminary Note

A share for the user’s home directories is created by default – edit it as you like. For example I’ll create a share that’s accessible by all users. You should have a look at the other swat features – they are all well explained.

 

5.1.1 Directory

First we have to create the directory that we want to share. Afterwards we change the owner, group and permissions.

mkdir -p /home/shares/allusers/
chown -R root:users /home/shares/allusers/
chmod -R 775 /home/shares/allusers/

 

5.1.2 Share Configuration

Click on “SHARES” in the swat menu. Afterwards insert a desired name for the new share into the corresponding field and click on “Create Share“.

swat_cs1

Now change the view to Advanced in the upper menu and edit the settings for the share.

  • comment = Share for all users (or something other)
  • path = /home/shares/allusers/ (the path to the directory that you created in step 5.1.1)
  • valid users = @users
  • force group = users
  • read only = No (if the users should be able to write to this share)
  • create mask = 0660
  • security mask = 0660
  • directory mask = 0771
  • directory security mask = 0771
  • available = Yes

swat_cs2

After that click on “Commit Changes” in the upper menu.

 

6 Adding And Managing Users

6.1 Linux System

Before you can add a user to Samba you have to create a useraccount on the Linux system.

useradd %username% -m -G users

E.g.:

useradd olli -m -G users

If the user shall also be able to access the Linux system, you have to assign a password to the user account. This is not required to access the Samba server – so if the user shall only have access to Samba proceed with step 6.2 .

passwd %username%

E.g.:

passwd olli

Now enter a password for the user.

 

6.2 Samba

In this step we add an existing user to the Samba user database:

smbpasswd -a %username%

E.g.:

smbpasswd -a olli

Afterwards you should be able access the Samba shares from your Windows workstation(s) via file browser or network drive.

 

  • Fedora: http://fedoraproject.org/
  • Samba: http://www.samba.org/

Comments

comments