Linux Samba almost setup

Tom Roche tom_roche at ncsu.edu
Tue Mar 9 07:45:11 GMT 1999


I'm trying to setup samba-1.9.18p10 on backpack.ncsu.edu
(hereafter BP), which runs RH5.2. I pass the first seven tests in
DIAGNOSIS.txt (attached), but fail test 8. I have accounts for myself
and 'guest' setup with identical IDs and passwords on 2 NT boxes and
backpack, and can login to all three boxes with both accounts. I can

* do all IP funstuff on BP (e.g. ping in/out, webserve, websurf)
* FTP in to BP as me from an NT box (but not as 'guest') 
* smbclient -L as guest
* nmblookup in and out
* can browse to BP in NT NetHood, and can see it but not connect as
  either me or 'guest'--either gets

> Incorrect password or unknown username

  with correct passwords and usernames.

I cannot connect to, net view, or net use, Samba from either of the
NT PCs. But Samba itself seems happy. Any diagnoses?

Your assistance is appreciated, Tom_Roche at ncsu.edu 

-------------- next part --------------
!==
!== DIAGNOSIS.txt for Samba release 1.9.18p10 20 Aug 1998
!==
Contributor:	Andrew Tridgell (Samba-Team)
Updated:	August 10, 1998 (John H Terpstra)

Subject:	DIAGNOSING YOUR SAMBA SERVER
===========================================================================

This file contains a list of tests you can perform to validate your
Samba server. It also tells you what the likely cause of the problem
is if it fails any one of these steps. If it passes all these tests
then it is probably working fine.

You should do ALL the tests, in the order shown. We have tried to
carefully choose them so later tests only use capabilities verified in
the earlier tests.

We would welcome additions to this set of tests. Please mail them to
samba-bugs at samba.anu.edu.au

If you send me an email saying "it doesn't work" and you have not
followed this test procedure then you should not be surprised if we
ignore your email.


ASSUMPTIONS
-----------

In all of the tests we assume you have a Samba server called BIGSERVER
and a PC called ACLIENT. We also assume the PC is running windows for
workgroups with a recent copy of the microsoft tcp/ip stack. Alternatively,
your PC may be running Windows 9X or Windows NT (Workstation or Server).

The procedure is similar for other types of clients.

We also assume you know the name of an available share in your
smb.conf. We will assume this share is called "tmp". You can add a
"tmp" share like by adding the following to smb.conf:

[tmp]
 comment = temporary files 
 path = /tmp
 read only = yes


THESE TESTS ASSUME VERSION 1.9.16 OR LATER OF THE SAMBA SUITE. SOME
COMMANDS SHOWN DID NOT EXIST IN EARLIER VERSIONS

Please pay attention to the error messages you receive. If any error message
reports that your server is being unfriendly you should first check that 
IP name resolution is correctly set up. eg: Make sure your /etc/resolv.conf
file points to name servers that really do exist. Also, some systems ship
with an /etc/nsswitch.conf file that is broken. If you have one of these
please check that name resolution does not try to use non-existing methods.

Also, if you do not have DNS server access for name resolution please check
that the settings for your smb.conf file results in "dns proxy = no". The
best way to check this is with "testparm smb.conf"


TEST 1:
-------

In the directory in which you store your smb.conf file, run the command
"testparm smb.conf". If it reports any errors then your smb.conf
configuration file is faulty.

Note:	Your smb.conf file may be located in:
	         /usr/local/samba/lib
	Or in:   /etc
	Or in:   /opt/samba/lib



TEST 2:
-------

Run the command "ping BIGSERVER" from the PC and "ping ACLIENT" from
the unix box. If you don't get a valid response then your TCP/IP
software is not correctly installed. 

Note that you will need to start a "dos prompt" window on the PC to
run ping.

If you get a message saying "host not found" or similar then your DNS
software or /etc/hosts file is not correctly setup. It is possible to
run samba without DNS entries for the server and client, but we assume
you do have correct entries for the remainder of these tests. 

Another reason why ping might fail is if your host is running firewall 
software. You will need to relax the rules to let in the workstation
in question, perhaps by allowing access from another subnet (on Linux
this is done via the ipfwadm program.)



TEST 3:
-------

Run the command "smbclient -L BIGSERVER" on the unix box. You
should get a list of available shares back. 

Condition 3a:
-------------
If you get a error message containing the string "Bad password" then
you probably have either an incorrect "hosts allow", "hosts deny" or
"valid users" line in your smb.conf, or your guest account is not
valid. Check what your guest account is using "testparm" and
temporarily remove any "hosts allow", "hosts deny", "valid users" or
"invalid users" lines.

Condition 3b:
-------------
If you get a "connection refused" response then the smbd server could
not be running. If you installed it in inetd.conf then you probably edited
that file incorrectly. If you installed it as a daemon then check that
it is running, and check that the netbios-ssn port is in a LISTEN
state using "netstat -a".

Condition 3c:
------------
If you get a "session request failed" then the server refused the
connection. If it says "your server software is being unfriendly" then
its probably because you have invalid command line parameters to smbd,
or a similar fatal problem with the initial startup of smbd. Also
check your config file (smb.conf) for syntax errors with "testparm"
and that the various directories where samba keeps its log and lock
files exist.

Condition 3d:
-------------
Another common cause of these two errors is having something already running 
on port 139, such as Samba (ie: smbd is running from inetd already) or
something like Digital's Pathworks. Check your inetd.conf file before trying
to start smbd as a daemon, it can avoid a lot of frustration!

Condition 3e:
-------------
And yet another possible cause for failure of TEST 3 is when the subnet mask
and / or broadcast address settings are incorrect. Please check that the
network interface IP Address / Broadcast Address / Subnet Mask settings are
correct and that Samba has correctly noted these in the log.nmb file.


Condition 3f:
-------------
Have you just changed the IP address of your samba server? And now samba does
not work? You are not alone. Samba may be storing a browse list and  / or a
WINS database on your samba server. When samba is first started up it reads
these files to preload the name cache and get the network up and running
quickly. If the IP addresses stored there differ from your new configuration
then things will get horibly confused. The solution is VERY simple.
Firstly, stop samba. Then delete both of these files. Then restart samba.
As soon as Samba starts it will re-create these files and will load then
with current information. Both files may be found in: /usr/loca/samba/var/locks
or in /var/lock/samba, or in /opt/samba/var/locks. You can find the lock
directory configured into your system by running: testparm | grep lock


Condition 3g:
-------------
You obtain the message "Not listening on called name". This means that
you have probably specified a "hosts allow" parameter to your smb.conf
file that excludes your localhost address (127.0.0.1) or that has other
incorrect settings. First comment this line out to see if that solves
the problem. If it does then make sure that your "hosts allow ="
specification includes your local subnet as well as "127."



TEST 4:
-------

Run the command "nmblookup -B BIGSERVER __SAMBA__". You should get the
IP address of your Samba server back.

If you don't then nmbd is incorrectly installed. Check your inetd.conf
if you run it from there, or that the daemon is running and listening
to udp port 137.

One common problem is that many inetd implementations can't take many
parameters on the command line. If this is the case then create a
one-line script that contains the right parameters and run that from
inetd.



TEST 5:
-------

run the command "nmblookup -B ACLIENT '*'"

You should get the PCs IP address back. If you don't then the client
software on the PC isn't installed correctly, or isn't started, or you
got the name of the PC wrong. 



TEST 6:
-------

Run the command "nmblookup -d 2 '*'"

This time we are trying the same as the previous test but are trying
it via a broadcast to the default broadcast address. A number of
Netbios/TCPIP hosts on the network should respond, although Samba may
not catch all of the responses in the short time it listens. You
should see "got a positive name query response" messages from several
hosts. 

If this doesn't give a similar result to the previous test then
nmblookup isn't correctly getting your broadcast address through its
automatic mechanism. In this case you should experiment use the
"interfaces" option in smb.conf to manually configure your IP
address, broadcast and netmask. 

If your PC and server aren't on the same subnet then you will need to
use the -B option to set the broadcast address to the that of the PCs
subnet.

This test will probably fail if your subnet mask and broadcast address are
not correct. (Refer to TEST 3 notes above).



TEST 7:
-------

Run the command "smbclient '\\BIGSERVER\TMP'". You should then be
prompted for a password. You should use the password of the account
you are logged into the unix box with. If you want to test with
another account then add the -U <accountname> option to the command
line. 

Once you enter the password you should get the "smb>" prompt. If you
don't then look at the error message. If it says "invalid network
name" then the service "tmp" is not correctly setup in your smb.conf.

If it says "bad password" then the likely causes are:

- you have shadow passords (or some other password system) but didn't
compile in support for them in smbd
- your "valid users" configuration is incorrect
- you have a mixed case password and you haven't enabled the "password
level" option at a high enough level
- the "path =" line in smb.conf is incorrect. Check it with testparm
- you enabled password encryption but didn't create the SMB encrypted
password file
- your user does not have an entry in the smbpassword file

Once connected you should be able to use the commands "dir" "get"
"put" etc. Type "help <command>" for instructions. You should
especially check that the amount of free disk space shown is correct
when you type "dir".



TEST 8:
-------

On the PC type the command "net view \\BIGSERVER". You will need to do
this from within a "dos prompt" window. You should get back a list of
available shares on the server.

If you get a "network name not found" or similar error then netbios
name resolution is not working. This is usually caused by a problem in
nmbd. To overcome it you could do one of the following (you only need
to choose one of them):

- fixup the nmbd installation
- add the IP address of BIGSERVER to the "wins server" box in the
advanced tcp/ip setup on the PC.
- enable windows name resolution via DNS in the advanced section of
the tcp/ip setup
- add BIGSERVER to your lmhosts file on the PC.

If you get a "invalid network name" or "bad password error" then the
same fixes apply as they did for the "smbclient -L" test above. In
particular, make sure your "hosts allow" line is correct (see the man
pages)

If you get "specified computer is not receiving requests" or similar
it probably means that the host is not contactable via tcp services.
Check to see if the host is running tcp wrappers, and if so add an entry in
the hosts.allow file for your client (or subnet, etc.)



TEST 9:
--------

Run the command "net use x: \\BIGSERVER\TMP". You should be prompted
for a password then you should get a "command completed successfully"
message. If not then your PC software is incorrectly installed or your
smb.conf is incorrect. make sure your "hosts allow" and other config
lines in smb.conf are correct.

It's also possible that the server can't work out what user name to
connect you as. To see if this is the problem add the line "user =
USERNAME" to the [tmp] section of smb.conf where "USERNAME" is the
username corresponding to the password you typed. If you find this
fixes things you may need the username mapping option.



TEST 10:
--------

From file manager try to browse the server. Your samba server should
appear in the browse list of your local workgroup (or the one you
specified in smb.conf). You should be able to double click on the name
of the server and get a list of shares. If you get a "invalid
password" error when you do then you are probably running WinNT 4.0 SP3 
or Windows 95 or 98 and it is refusing to browse a server that does not
support encrypted passwords.

In this case either set "security = server" AND
"password server = Windows_NT_Machine" in your smb.conf file, or enable
encrypted passwords AFTER compiling in support for encrypted passwords
(refer to the Makefile). NOTE: As of Samba-1.9.18 encrypted password
support is native and just needs to be turned on in your smb.conf file.
PS: Do NOT forget to create your smbpasswd file when you do turn this on.



Still having troubles?
----------------------

Try the mailing list or newsgroup, or use the tcpdump-smb utility to
sniff the problem. The official samba mailing list can be reached at
samba at samba.anu.edu.au. To find out more about samba and how to
subscribe to the mailing list check out the samba web page at
              http://samba.anu.edu.au/samba

Also look at the other docs in the Samba package!


-------------- next part --------------
### last edited M 8 Mar 99 tlroche
### original is /etc/smb.conf.0

# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example

# Any line which starts with a ; (semi-colon) or a # (hash) 
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable

# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not many any basic syntactic errors. 
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name
   workgroup = BACKPACK

# server string is the equivalent of the NT Description field
   server string = BackPack Samba Server

# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
;   hosts allow = 192.168.1. 192.168.2. 127.

# if you want to automatically load your printer list rather
# than setting them up individually then you'll need this
;   printcap name = /etc/printcap
;   load printers = yes

# It should not be necessary to spell out the print system type unless
# yours is non-standard. Currently supported print systems include:
# bsd, sysv, plp, lprng, aix, hpux, qnx
;   printing = bsd

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
  guest account = guest

# this tells Samba to use a separate log file for each machine
# that connects
  log file = /var/log/samba/log.%m

# Put a capping on the size of the log files (in Kb).
   max log size = 50

# Security mode. Most people will want user level security. See
# security_level.txt for details.
   security = user
# Use password server option only with security = server
;   password server = <NT-Server-Name>

# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.
  password level = 8
  username level = 8

# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
  encrypt passwords = yes
;  smb passwd file = /etc/smbpasswd
  smb passwd file = /usr/local/samba/private/smbpasswd

# Unix users can map to different SMB User names
;  username map = /etc/smbusers

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /etc/smb.conf.%m

# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details
   socket options = TCP_NODELAY 

# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
;   interfaces = 192.168.12.2/24 192.168.13.2/24 

# Configure remote browse list synchronisation here
#  request announcement to, or browse list sync from:
#	a specific host or from / to a whole subnet (see below)
;   remote browse sync = 192.168.3.25 192.168.5.255
# Cause this host to announce itself to local subnets here
;   remote announce = 192.168.1.255 192.168.2.44

# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
;   local master = no

# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
;   os level = 33

# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
;   domain master = yes 

# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
;   preferred master = yes

# Use only if you have an NT server on your network that has been
# configured at install time to be a primary domain controller.
;   domain controller = <NT-Domain-Controller-SMBName>

# Enable this if you want Samba to be a domain logon server for 
# Windows95 workstations. 
;   domain logons = yes

# if you enable domain logons then you may want a per-machine or
# per user logon script
# run a specific logon batch file per workstation (machine)
;   logon script = %m.bat
# run a specific logon batch file per username
;   logon script = %U.bat

# Where to store roving profiles (only for Win95 and WinNT)
#        %L substitutes for this servers netbios name, %U is username
#        You must uncomment the [Profiles] share below
;   logon path = \\%L\Profiles\%U

# All NetBIOS names must be resolved to IP Addresses
# 'Name Resolve Order' allows the named resolution mechanism to be specified
# the default order is "host lmhosts wins bcast". "host" means use the unix
# system gethostbyname() function call that will use either /etc/hosts OR
# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf
# and the /etc/resolv.conf file. "host" therefore is system configuration
# dependant. This parameter is most often of use to prevent DNS lookups
# in order to resolve NetBIOS names to IP Addresses. Use with care!
# The example below excludes use of name resolution for machines that are NOT
# on the local network segment
# - OR - are not deliberately to be known via lmhosts or via WINS.
;  name resolve order = wins lmhosts bcast
; NT boxes on csc.ncsu.edu use DNS, also has good WINS server (below)
  name resolve order = host wins bcast

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
;   wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
#	Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z
   wins server = 152.1.102.60

# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one	WINS Server on the network. The default is NO.
;   wins proxy = yes

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# this has been changed in version 1.9.18 to no.
   dns proxy = no 

# Case Preservation can be handy - system default is _no_
# NOTE: These can be set on a per share basis
;  preserve case = no
;  short preserve case = no
# Default case is normally upper case for all DOS files
;  default case = lower
# Be very careful with case sensitivity - it can break things!
;  case sensitive = no

#============================ Share Definitions ==============================
[homes]
   comment = Home Directories
   browseable = no
   writable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
;   comment = Network Logon Service
;   path = /home/netlogon
;   guest ok = yes
;   writable = no
;   share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
;    path = /home/profiles
;    browseable = no
;    guest ok = yes


# NOTE: If you have a BSD-style print system there is no need to 
# specifically define each individual printer
[printers]
;   comment = All Printers
   path = /var/spool/samba
;   browseable = no
# Set public = yes to allow user 'guest account' to print
;   guest ok = no
;   writable = no
# testparm: WARNING: [printers] service MUST be printable!
   printable = yes

# This one is useful for people to share files
[tmp]
   comment = Temporary file space
   path = /tmp
   read only = no
   public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
;   comment = Public Stuff
;   path = /home/samba
;   public = yes
;   writable = yes
;   printable = no
;   write list = @staff

# Other examples. 
#
# A private printer, usable only by fred. Spool data will be placed in fred's
# home directory. Note that fred must have write access to the spool directory,
# wherever it is.
;[fredsprn]
;   comment = Fred's Printer
;   valid users = fred
;   path = /homes/fred
;   printer = freds_printer
;   public = no
;   writable = no
;   printable = yes

# A private directory, usable only by fred. Note that fred requires write
# access to the directory.
[tlrdir]
   comment = tlr space
   path = /home/tlroche
   valid users = tlroche
   public = no
   writable = yes
   printable = no

# a service which has a different directory for each machine that connects
# this allows you to tailor configurations to incoming machines. You could
# also use the %u option to tailor it by user name.
# The %m gets replaced with the machine name that is connecting.
;[pchome]
;  comment = PC Directories
;  path = /usr/pc/%m
;  public = no
;  writable = yes

# A publicly accessible directory, read/write to all users. Note that all files
# created in the directory by users will be owned by the default user, so
# any user with access can delete any other user's files. Obviously this
# directory must be writable by the default user. Another user could of course
# be specified, in which case all files would be owned by that user instead.
;[public]
;   path = /usr/somewhere/else/public
;   public = yes
;   only guest = yes
;   writable = yes
;   printable = no

# The following two entries demonstrate how to share a directory so that two
# users can place files there that will be owned by the specific users. In this
# setup, the directory should be writable by both users and should have the
# sticky bit set on it to prevent abuse. Obviously this could be extended to
# as many users as required.
;[myshare]
;   comment = Mary's and Fred's stuff
;   path = /usr/somewhere/shared
;   valid users = mary fred
;   public = no
;   writable = yes
;   printable = no
;   create mask = 0765




More information about the samba mailing list