Author

Christopher Marshall (christopherlmarshall@yahoo.com)

Raw Notes on SAMBA

# useful commands:
smbclient -L <netbios name or ip address> -U user%pass
mount -t smbfs //machine_name/share_name mount_point -o username=userr,password=pass

# this is the windows equivalent of smbclient -L machine_name
net view \\machine_name

# when encrypting passwords, you need to add the first user 2 times from the root
# account like this:
smbpasswd -a chris
smbpasswd -a chris
# to both initialize the password database and add the user to it
# If you want the gues account (nobody) to work, you have to do this:
smbpasswd -a nobody
smbpasswd -a nobody
# and add a blank password each time.
# You can automate the setting of the password like this
(echo ""; echo "") | smbpasswd -a nobody -s
# which would set the old and new password to blank.
# It seems you can also set a password this way without prompts
   smbpasswd -a user password
# as in
   smbpasswd -a nobody ""


# here's how to send a winpopup message to someone
echo "some message" | smbclient -M <netbios name> 

# and here's how to set up a receiver in the smb.conf file
# '%s' is the name of the temporary file the message is put in
message command = /bin/bash -c 'mail chris -s "samba message" < %s; rm %s' &

# windows 98 uses encrypted passwords by default and won't be able to access 
# a samba server unless the samba server is also using encrypted passwords

# nmblookup a netbios name over broadcast
nmblookup netbios_name
# node status query over broadcast
nmblookup -A <ip address>
# name lookup directed at a wins server
nmblookup -R -U <wins server ip address> <netbios name>

# elcheapo netbios gateway
        works somewhat
        chrism1 registers the name with an ip address of 12.26.73.130 instead of 10.1.0.2
                that's an interesting problem!
                I wonder how to solve it?
                what if I separated my DNS from my netbios name?
                I could set netbios name = chrism2
                that worked!  I can't believe it!
        next step is to reboot home PC in windows and do a lookup on chrism2 from marshall_home

# print share definition
# variables for use in print shares
# %s full pathname of file on samba server to be printed
# %f name without path
# %p the name of the unix printer to use
# %j the number of the print job (for use with lprm, lppause, and lpresume)
#
# the -r is important, because, samba will receive the remote file and write it to the /tmp directory
# to invoke the print command on it.  lpr file.ps will spool the file and leave file.ps in existance
# after printing it.  lpr -r file.ps deletes the file after spooling it. In this case, that's what
# you want.
# I can't figure out what the "printer = lp" line does.  The Samba book says it sets the name of the
# printer.  Which name?  The one the samba client sees?  That doesn't make sense

[printer1]
        printable = yes
        print command = /usr/bin/lpr -r %s
        printer = lp
        printing = BSD
        read only = yes
        guest ok = yes
        

# debugging password problems
# by using these settings, you can cause SAMBA to log the entire password chat session
# in plain text to the log.
password chat debug = yes
log level = 100

# a simple workstation configuration with two disk shares and a printer share that uses
# a wins server and encrypted passwords
[global]
        workgroup = somegroup 
        netbios name = workstation_a
        server string = this is one mighty fine workstation
        encrypt password = yes
        wins server = 10.0.0.1
[share1]
        comment = this a one of my disk shares
        path = /export/samba/share1
        guest ok = yes
[share2]
        comment = this another of my disk shares
        path = /export/samba/share2
        guest ok = yes
[printer1]
        comment = this is my print share
        printable = yes
        print command = /usr/bin/lpr -r %s
        printer = lp
        printing = BSD
        read only = yes
        guest ok = yes

# primary domain controller from SAMBA-HOW-TO
[global]
        netbios name = somepdc
        workgroup = somegroup
        passdb backend = tdbsam
#       passdb backend = smbpasswd
#       passdb backend = ldapsam
        os level = 33
        preferred master = auto
        local master = yes
        security = user
        domain logons = yes
        logon path = \\%N\profiles\%U
        logon drive = H:
        logon home = \\homeserver\%U\winprofile
        logon script = logon.cmd
[netlogon]
        path = /var/lib/samba/netlogon
        read only = yes
        write list = user1 user2 ...
[profiles]
        path = /var/lib/samba/profiles
        read only = no
        create mask = 0600
        directory mask = 0700

hopeless_linux: RawNotes/samba (last modified 2007-07-01 16:01:00)