Running Samba


October 10, 2002

Now using rpm version of samba, so didn't have to compile. Since I was setting up samba on a brand new computer, had to change the domain so that it would allow this new computer to connect. So, I needed to run the following command on the new unix server that was going to share items with Windows.

smbpasswd -j ELECSHOP -U administrator -r ESHOP

Now here are the uncommented lines from the new smb.conf.

[global]
workgroup = ELECSHOP
server string = Mentor
hosts allow = 128.135.152. 127.
log file = /var/log/samba/%m.log
max log size = 0
security = domain
password server = ESHOP
encrypt passwords = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = no
create mask = 0664
directory mask = 0775

[disk1]
comment = Backup Disk
path = /net/edg/disk1
public = no
writeable = yes

Add other shares here


  • Download latest version from the Samba website
  • Gunzip and untar the file
  • In the ~/samba-2.2.0/source file, run ./configure --prefix=/usr/local/samba-2.2.0
  • Run make
  • Run make install
  • Create the configuration file and clean up a few things
  • In /usr/local/samba-2.2.0/lib, create the file, smb.conf. There are tons of things that could be configured here. The file that we are going to use, looks something like this:

    [global]
    # Identification
    netbios name = SHOP
    server string = Samba %v on %L
    workgroup = ESHOP

    # Browsing settings
    ;os level = 34
    ;local master = yes
    ;domain master = yes
    ;preferred master = yes
    ;domain logons = yes

    # Security
    ;hosts allow = 192.168.22.
    valid users = joe, pete, emily, bob, sarah, kelsey
    guest account = guest
    encrypt passwords = yes

    # WINS info
    ;wins support = yes
    ;name resolve order = lmhosts wins hosts
    ;dns proxy = yes

    [people]
    comment = Users' Directories
    path = /net/shop/data1/people/%u
    public = yes
    writeable = yes

    [projects]
    comment = Projects Directory
    path = /net/shop/data2/projects
    public = yes
    writeable = yes

    End of smb.conf file

    Also want to be able to use man pages provided, so add to /etc/profile:
    export MANPATH=$MANPATH:/usr/local/samba-2.2.0/man

    Touch the file samba.log and nmbd.log to create log files to use with smbd and nmbd.

    Set up samba to start automatically each time the machine is booted. In /etc/rc.d/init.d, copy the file acct to samba. Then edit this samba file so that it calls the samba program instead of acct. Alternatively, you could just write a new script, but I'm pretty lazy and would rather copy someone else's. My script ends up looking like this:

    #!/bin/sh
    #
    # samba: Starts the Samba Server
    #
    # Version: @(#) /etc/rc.d/init.d/samba
    #
    # chkconfig: 2345 90 10
    # description: Starts and stops the Samba Server at boot time and shutdown.
    #
    # processname: samba
    # config: /usr/local/samba-2.2.0/lib/smb.conf
    # hide: true

    # Source function library.
    . /etc/rc.d/init.d/functions

    # See how we were called.
    case "$1" in
    start)
    echo -n "Starting Samba Server: "
    /usr/local/samba-2.2.0/bin/smbd -D -d1 -l/usr/local/samba-2.2.0/lib/samba.log -s/usr/local/samba-2.2.0/lib/smb.conf
    /usr/local/samba-2.2.0/bin/nmbd -D -l/usr/local/samba-2.2.0/lib/nmbd.log -s/usr/local/samba-2.2.0/lib/smb.conf
    touch /var/lock/subsys/samba
    echo
    ;;
    stop)
    echo -n "Shutting down Samba Server: "
    killproc smbd
    killproc nmbd
    rm -f /var/lock/subsys/samba
    echo
    ;;
    status)
    status smbd
    status nmbd
    ;;
    restart)
    echo -n "Restarting Samba Server. "
    if [ -f /var/lock/subsys/samba ]; then
    killproc smbd
    killproc nmbd
    /usr/local/samba-2.2.0/bin/smbd -D -l/usr/local/samba-2.2.0/lib/samba.log -s/usr/local/samba-2.2.0/lib/smb.conf
    /usr/local/samba-2.2.0/bin/nmbd -D -l/usr/local/samba-2.2.0/lib/nmbd.log -s/usr/local/samba/lib/smb.conf
    else /usr/local/samba-2.2.0/bin/smbd -D -l/usr/local/samba-2.2.0/lib/samba.log -s/usr/local/samba/lib/smb.conf
    /usr/local/samba-2.2.0/bin/nmbd -D -l/usr/local/samba-2.2.0/lib/nmbd.log -s/usr/local/samba/lib/smb.conf
    touch /var/lock/subsys/samba
    fi
    echo
    ;;
    *)
    echo "*** Usage: samba {start|stop|status|restart}"
    exit 1
    esac

    exit 0

    Then to start and stop samba (which consists of smbd and nmbd), run /etc/rc.d/init.d/samba {start|stop|status|restart}

    PROBLEMS

    I got into a lot of trouble when I made the samba server be the master server for the entire workgroup. For some reason, none of the other machines appeared under network neighborhood, though direct mounting of disks was ok. And running net view // would show everything that was connected. So something was not right with the browser. I changed all the 95/98 machines to not be the master browser, more so that I wouldn't have to worry about them if this ever happens again. And I'm going to comment out all of the master browser info in the smb.conf file.


    Old Directions from 1999

    That’s it. Now have a binary version of samba in /opt/samba

    Programs/Files of interest:

    Since HP-UX handles printing in a SysV way, a fake printcap was created (just a file with the word plot in it). The file smb.conf then pointed to this printcap file (which I put in /opt/samba). A spooling directory needed to be made for use. The directory created was /usr/spool/public, with permissions of 777 and the sticky bit set (chmod +t /usr/spool/public). Other changes to the smb.conf (which I copied from the simple directory in the example directory) file were:

    printing = sysv

    guest account = guest

    ; log file = … This log file was commented out

    [plot]

    comment = HP Plotter

    path = /usr/spool/public

    browsable = no

    printable = yes

    public = true

    only guest = yes

    Start up samba with the following command:

    /opt/samba/bin/smbd –D –l/opt/samba/log –s/opt/samba/lib/smb.conf

    I then went to a Win95 machine and created a new printer (network printer, location //fozzie/plot). Once finished, loaded a file in the Gerber viewer and printed it. Name of the plotter is "Plotter through fozzie".

    Starting Up Samba at System Startup

    Create the following files:

    These 3 files were created by copying the acct files already present and editing them to work with samba.

    Make the following links:

    ln –s /sbin/init.d/samba S900samba

    ln –s /sbin/init.d/samba K100samba

    Now, when the system reboots, Samba will automatically start. To manually start/stop samba, use the following:

    /sbin/init.d/samba stop

    /sbin/init.d/samba start