Configuring SAMBA v1.0

by 

Hugo "Lord Vega" Samayoa

lordvega@teknofx.com

 

Current Version - Samba 2.0.7

Download: http://us4.samba.org/samba/ftp/samba-latest.tar.gz

 

Table of Contents

1) Downloading SAMBA by CVS
2) Restarting SAMBA
3) Making SAMBA automatically start at bootup
4) Configuring SAMBA's smb.conf
5) Adding SAMBA Users for WIN9X Clients
6) Running SAMBA as a PDC
7) Adding SAMBA Users for NT Clients

 

 

 

 

CVS - Concurrent Versions System

 

To gain access via anonymous cvs use the following steps.

 

1)      Install a recent copy of cvs. All you really need is a copy of the cvs client binary.

 

2)      Run the command  -

cvs -d :pserver:cvs@cvs.samba.org:/cvsroot login

 

3)      When it asks you for a password type cvs

 

4)      Run the command  -

cvs -d :pserver:cvs@cvs.samba.org:/cvsroot co samba

 

5)      This will create a directory called samba containing the latest samba source code.

 

6)      Whenever you want to merge in the latest code changes use the following command from within the samba directory:

            cvs update -d -P

 

 

 

Restarting SAMBA on a Red Hat Based Distro / System V

/etc/rc.d/init.d/smb restart

 

NOTE: on some distributions ie Caldera there is no smb file instead its called samba

 

 

 

Making SAMBA automatically run at startup on a Red Hat Based Distro

1)      First check what your linux runlevel. If you don't know = what this is then run this simple command. J

cat /etc/inittab | grep id | sed /s/"id:"/""/ | sed s/":initdefault:"/""/

or /sbin/runlevel

 

The number that comes up is your runlevel. Most will be either 3 or 5. Hint, if you have runlevel 0 or 6 then you're lying.

 

2)      Ok your runlevel startup scripts are located at, $1 runlevel number, /etc/rc.d/rc$1.d

 

3)      Ok check if you already have a samba link

            ls *smb

 

4)      If you already have a samba link if it starts with an S then samba is already automatically starting up. If it starts with an K then get the number ie 35 out of K35smb and run the command

mv K35smb S35smb

Substitute with the real number.

 

5)      If you don't have a link then run this command

ln -s ../init.d/smb S35smb

Configuring smb.conf

Ok first of all most people don't agree with this method at all but I'll just say that I've installed SAMBA on more than 75 Servers.

Ok the other thing is that I'm going to edit this file with the pico editor, which is part of the pine mail package. Most people use vi. The only reason I use pico is because like most of us we started using M$, and if you had any DOS experience M$DOS edit is similar to pico.

 

1)      First delete the smb.conf file

rm -f /etc/smb.conf

 

2)      Then create a blank smb.conf file

touch /etc/smb.conf

 

3)      Edit the file

pico /etc/smb.conf

 

4)      Input this simple configuration

[global]

            netbios name = CLUGSMB

            workgroup = CLUG

            security = user

            smb passwd file /etc/smbpasswd

[homes]

            comment Unix home directory space

            path = %H

            writeable = yes

            valid users = %S

            create mode = 0600

            directory mode = 0700

            locking = no

 

5)      Save the file <ctrl> & O,  hit <enter> to accept default file name

 

6)      Exit by pressing <ctrl> & X

 

7)      Restart SAMBA

 

 

 

Adding Samba Users For Win9x Clients

1) Run the command: 

    smbpasswd -a $USER

    Off coarse substitute $USER with the user name

2) Then Set the password 

    smbpasswd $USER

 

 

 

 

Running SAMBA as a PDC

Use this config file

[----------------------------------------------------CUT HERE--------------------------------------------------------]

[global]

        dns proxy = no

        security = domain

        encrypt passwords = yes

        workgroup = WORKGROUP

        server string = Samba Server

        socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192

        netbios name = SAMBASERVER

        log file = /var/log/samba/log.%m

        load printers = no

        max log size = 50

        interfaces = 192.168.100.1/24

        smb passwd file = /etc/smbpasswd

        local master = yes

        domain master = yes

        preferred master = yes

        domain logons = yes

[homes]

        writable = yes

        comment = Home Directories

        valid users = me

        mangle case = yes

        write list = me

[----------------------------------------------------CUT HERE--------------------------------------------------------]

Remember to change the interfaces to your actual ip address.

For first Network Card

/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'

or For Second 

/sbin/ifconfig eth1 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'

or For Third Card -----------> You can do this one your self. :)

 

 

Adding SAMBA Users for NT Clients

1) Run this command

    echo WS1$:x:801:800::/dev/null:bin/false >> /etc/passwd

    This will add WS1 to the linux passwd file. You need the $ to define a machine account

2) Run this command 

    smbpasswd -a -m WS1

    This will store the machine account in the samba passwd file

3) Change the passwd

    smbpasswd WS1$

4) The 801 in the 1st command is the UID of the user then 800 is the group. please make sure that 801 isn't taken up by another user.

    cat /etc/passwd | grep :x:801: && echo "USER EXISTS" || echo "USER NOT FOUND"