Wednesday, May 15, 2013

install samba4 on panther

Well, installing samba in ubuntu may be easy. I was able to install samba in ubuntu LTS 12 in a minute, using apt. Everything went so smooth. But when I tried to install samba in ubuntu 10.10, which is no longer supported by now (May 2013), it turned out to be painful. Here is how I eventually made it successfully.

PART I

install samba4 on panther (ubuntu 10.10 Maverick)

1)download samba-4.0.5 source code from samba.org;

2)install some required dependencies: python-dnspython, git and a few others. (launchpad.com will help on this);

3)configure using waf as follows:
#cd path-to-samba4
#LDFLAGS="-lm -ldl -lutil" ./buildtools/bin/waf configure

#make
#make install

The default installation will be located at:
/usr/local/samba

alternatively, you may use the python way of doing it:
./install_by_python.sh


 PART II

the configure file. here is a simple example:

[global]
    workgroup = NHLBI.NIH.GOV
    server string = %h server (Samba, Ubuntu)
    map to guest = Bad User
    obey pam restrictions = Yes
    pam password change = Yes
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    unix password sync = Yes
    syslog = 0
    log file = /var/log/samba/log.%m
    max log size = 1000
    dns proxy = No
    usershare allow guests = Yes
    panic action = /usr/share/samba/panic-action %d
    idmap config * : backend = tdb

[share]
    comment = this is my share 1
    path = /share
    guest ok = Yes



PART III
add the following rules to your iptables.

iptables -A INPUT -p udp -m udp --dport 137 -j ACCEPT
iptables -A NPUT -p udp -m udp --dport 138 -j ACCEPTiptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPTiptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

PART IV
Before you start your smbd daemon, you need to do two minor tasks:
(a)Make sure the ports (137,139 etc) are available. If you have other applications sunning similar services, make sure they don't conflict the ports;
(b) #touch /etc/printcap
This file does not exists by default. So you need to create one for the first time use.

 You may find the smbd binary in prefix/sbin/ directory. Run it. Then you can monitor your samba connections by:
#smbstatus
It will tell you how many clients are currently connected to your server.
Enjoy.

No comments:

Post a Comment