Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting up Samba

Status
Not open for further replies.

seanf77

IS-IT--Management
Oct 11, 2001
29
0
0
US
I am trying to setup Samba for the first time. I downloaded the binaries from and installed the package. I configured a real basic smb.conf file (such lines as workgroup, security = share, etc.). I then started the smbd and nmbd daemons. However, a net view \\machinename from my XP box tells me the network name cannot be found. Same message if try via IP. I am able to ping the Linux box successfully. On the Linux box itself, if I do a "smbclient -L 192.168.0.3" I get message that says connction refused to 192.168.0.3:139. I verified that this port was defined in /etc/services. I don't have anything in the smb.conf file that would restrict access. Any ideas what might be happening here?

Thanks!
Sean
 
Post info like:
ipchains -L or (2.4+) iptables -L
The results of $(pidof smbd ; pidof nmbd)
And run testparm.

Thats a good start;)
 
also, post your smb.conf file. AV
tnedor@yahoo.com

Did this post help? Click below to let me know.
 
Sorry about that...here ya go.

IPchains -L:
Chain input (policy ACCEPT):
Chain output (policy ACCEPT):
Chain Forward (policy ACCEPT)

Output of testparm:

Load smb config files from /etc/samba/smb.conf
Processing section "[firstshare]"
Loaded services file OK.
WARNING: You have some share names that are longer than 8 chars
These may give errors while browsing or may not be accessible
to some older clients
Press enter to see a dump of your service definitions
# Global parameters
[global]
coding system =
client code page = 850
workgroup = HOME
netbios name = FTPWEB1
netbios aliases =
netbios scope =
server string = FTPWEB server
interfaces =
bind interfaces only = No
security = SHARE
encrypt passwords = No
update encrypted = No
allow trusted domains = Yes
hosts equiv =
min password length = 5
map to guest = Never
null passwords = No
password server =
smb passwd file = /etc/samba/smbpasswd
root directory = /
passwd program = /bin/passwd
passwd chat = *new*password* %n\n *new*password* %n\n *changed*
passwd chat debug = No
username map =
password level = 0
username level = 0
unix password sync = No
restrict anonymous = No
use rhosts = No
ssl = No
ssl hosts =
ssl hosts resign =
ssl CA certDir =
ssl CA certFile =
ssl server cert =
ssl server key =
ssl client cert =
ssl client key =
ssl require clientcert = No
ssl require servercert = No
ssl ciphers =
ssl version = ssl2or3
ssl compatibility = No
debug level = 2
syslog = 1
syslog only = No
log file =
max log size = 5000
debug timestamp = Yes
debug hires timestamp = No
debug pid = No
debug uid = No
protocol = NT1
read bmpx = No
read raw = Yes
write raw = Yes
nt smb support = Yes
nt pipe support = Yes
nt acl support = Yes
announce version = 4.2
announce as = NT
max mux = 50
max xmit = 65535
name resolve order = bcast lmhosts
max ttl = 259200
max wins ttl = 518400
min wins ttl = 21600
time server = No
change notify timeout = 60
deadtime = 0
getwd cache = Yes
keepalive = 300
lpq cache time = 10
max disk size = 0
max open files = 10000
read prediction = No
read size = 16384
shared mem size = 1048576
socket options = TCP_NODELAY
stat cache size = 50
load printers = Yes
printcap name = /etc/printcap
printer driver file = /etc/samba/printers.def
strip dot = No
character set =
mangled stack = 50
stat cache = Yes
domain groups =
domain admin group =
domain guest group =
domain admin users =
domain guest users =
machine password timeout = 604800
add user script =
delete user script =
logon script =
logon path = \\%N\%U\profile
logon drive =
logon home = \\%N\%U
domain logons = No
os level = 20
lm announce = Auto
lm interval = 60
preferred master = No
local master = Yes
domain master = No
browse list = Yes
dns proxy = Yes
wins proxy = No
wins server =
wins support = No
wins hook =
kernel oplocks = Yes
ole locking compatibility = Yes
oplock break wait time = 10
smbrun = /usr/bin/smbrun
config file =
auto services =
lock directory = /var/lock/samba
default service =
message command =
dfree command =
valid chars =
remote announce =
remote browse sync =
socket address = 0.0.0.0
homedir map = auto.home
time offset = 0
unix realname = No
NIS homedir = No
source environment =
panic action =
comment =
path =
revalidate = No
username =
guest account = nobody
invalid users =
valid users =
admin users =
read list =
write list =
force user =
force group =
writeable = No
create mask = 0744
force create mode = 00
security mask = -1
force security mode = -1
directory mask = 0755
force directory mode = 00
directory security mask = -1
force directory security mode = -1
inherit permissions = No
guest only = No
guest ok = No
only user = No
hosts allow =
hosts deny =
status = Yes
max connections = 0
min print space = 0
strict sync = No
sync always = No
write cache size = 0
printable = No
postscript = No
printing = bsd
print command = lpr -r -P%p %s
lpq command = lpq -P%p
lprm command = lprm -P%p %j
lppause command =
lpresume command =
queuepause command =
queueresume command =
printer =
printer driver = NULL
printer driver location =
default case = lower
case sensitive = No
preserve case = Yes
short preserve case = Yes
mangle case = No
mangling char = ~
hide dot files = Yes
delete veto files = No
veto files =
hide files =
veto oplock files =
map system = No
map hidden = No
map archive = Yes
mangled names = Yes
mangled map =
browseable = Yes
blocking locks = Yes
fake oplocks = No
locking = Yes
oplocks = Yes
level2 oplocks = No
oplock contention limit = 2
strict locking = No
share modes = Yes
copy =
include =
preexec =
preexec close = No
postexec =
root preexec =
root preexec close = No
root postexec =
available = Yes
volume =
fstype = NTFS
set directory = No
wide links = Yes
follow symlinks = Yes
dont descend =
magic script =
magic output =
delete readonly = No
dos filetimes = No
dos filetime resolution = No
fake directory create times = No

[firstshare]
comment = test share
path = /test
writeable = Yes
guest ok = Yes

Contents of smb.conf:

[global]

workgroup = HOME
server string = FTPWEB server
name resolve order = bcast lmhosts
netbios name = FTPWEB1
security = share

[firstshare]

comment = test share
path = /test
writeable = yes
guest ok = yes

When I did the pidof command for smbd and nbmd, it brings up nothing...does this mean it is not really running? If I do a /usr/local/samba/bin/smbd start and nmbd start it return to a command prompt, so I assumed it started, but maybe I am wrong...?

Thanks for your help!


 
It is important that the services be running of course:)

Some distros may not use pidof , I don't know, so this
is a more determinate test:

for xx in $(echo "nmbd smbd")
do
ps -ef | grep $xx | awk ' {print $2}'
done

If the services are running you should get 4 pids: two
for the grep search and two for the daemons.

If they are not running:
Please check your logfiles for failure messages and causes.

Assuming your wkgroup names are identical, you have
password encryption enabled for win 95b/98+ clients
and the services are running you should be okay.

Make sure that you have local host name resolution for
your chosen name in /etc/hosts, this is a common problem.
 
Cool, thanks Marsd. Where would I find these log files? When I ran the script above I got only two pids. In case you haven't figured it out I am totally new to the Linux world :) I will also check the /etc/hosts...this should have an entry for my local machine?

What exactly does that script do anyways?

Thanks for all your help!

 
Your log files should be under the /var/log directory.
Check /var/log/messages and /var/log/local, /var/log/warn
for samba error messages.
This should do it:
for xx in `ls /var/log`
do
if [ -f /var/log/$xx ]
then
grep smb /var/log/$xx
else
echo 2 > /dev/null
continue
fi
done

If samba is installed(rpm -q samba) correctly and it
simply cannot start (usually due to name resolution)
Check your /etc/hosts for a line like this:
172.16.1.2 myhostname.domain.name myhostnameIf there is not enter one.There are other possibilities of course, but this is a
good start.

On your other question:
It takes two strings: smbd and nmbd(names of your samba
daemons)uses ps -ef to grep for these strings one after
another.
The result would ideally contains all process info for
the daemon processes as well as the grep processes.
Awk is used to cut the second column of the output
(pid) and display it.
The script above does the same thing but searches for
the string smb in all files in the /var/log directory,
while disposing of directory errors.
 
Well now I am kinda confused...I don't have a /var/log/warn or a /var/log/local anywhere. I looked in the /var/log/messages but did not see any entries related to smbd. If I do a netstat -a it does not list netbios-ssn, so I assume that means the daemons are not starting. I am not sure why that is though...if I do a /usr/local/samba/bin/smbd -D (or without) it returns me to a command prompt, but I don't think it's actually starting.If I do rpm -q samba it says the package is not installed, even though I downloaded the latest from samba.org, and followed the instructions it provided (./configure, make, make install). So it seems either it is not installed properly, or it is but for whatever reason the daemons will not start...
 
You compiled and installed it from source. Okay.
That makes some sense.

Go ahead and add the following lines to your smb.conf:
debug level = 4
log file = /var/log/samba/smb.log
testparm -c (location of your smb.conf) : no errors;)
Next:
mkdir /var/log/samba && touch /var/log/samba/smb.log
Then cd /usr/local/samba/bin/smbd -D || echo "Fail, $?, $_."
Then the same for your nmbd.

If you get failures your log will catch them.

HTH
M
 
Should read: add these two lines
debug level = 4
log file = /var/log/samba/smb.log
THEN run testparm -c (your smb.conf)
...
 
Hi,

In case its not crystal clear from marsd's advice above you would start the daemons like this (must be as root) :

# /usr/local/samba/bin/smbd -D
# /usr/local/samba/bin/nmbd -D

If you then do a

ps -aux | grep mbd

.. you should get three lines back showing the two daemons active plus the 'grep' command you just did. Once you have the startup working its best to put the above lines in a startup script such as /etc/rc.d/rc.local so that the server starts when you boot up.

The other approach, if you are using a rpm based linux distribution, is to grab the relevants rpms because that way you'll get sysv init scripts to easily start/stop the servers, etc.

Hope this helps
 
It's working!! :)

Although it was sort of a work-around...last night I tried reinstalling from the distro CD (the rpm package vs a tarball). However, because I have no idea what I am doing :), I attempted to start the services the same way I have all along, but that didn't work. I came across something on the web that mentioned doing a "samba restart"....I did that, and now the services are started and my XP machine can see the Linux machine. I did by the way try what you mentioned above, about setting up the log file and stuff. Nothing got trapped in the log, but when I added the || echo "Fail, $?, $_." at the end, it returned with a "Fail, 255, -D". Not sure what that means...

So anyways, it's working..I am still curious what went wrong to begin with. I am also curious...with the RPM distro, how does do the services start up on boot up? In the inet.d?

Thanks marsd for all your help! :)
 
As long as you can verify that your configuration works
thats great;)
I would be worried about starting and stopping the service
though if it is so finicky about what commands it will take.
I would also make sure that you are logging..thats the first
place to look when troubles start.

The fail line just gives you warning that the service did
not start, since there was some confusion on what was going
on. The number is the error code and the -D is the failed
command: the daemonize arg in this case, which doesn't mean
anything now..

What version of samba was this?
 
The version I loaded was the latest from samba.org. The version I loaded from the Red Hat distro CD was 2.0.7 I believe.
 
There are problems with 2.0.7: you should probably
upgrade to at least 2.0.10, unless you are not really worried about security.
 
Congratulations Sean for the sucdessful installation.
I was going to start the installation of samba to serve out 1GB arrays to the network. Before I started off (I have read the O'Reilly book on Samba already) I thought t would be great if you could summarize all the steps you personally went through for the installation. That would be real great.
Thanks.
 
Sure...here is what I did.

1) Downloaded latest version of Samba from 2) Did a gunzip filename.tar.gz, and then a tar -xvf filename.tar.
3) Basically everything else I did from here on in is documented in all of the posts in this thread. In the end I ended up installing the RPM from the Red Hat distro CD, and then used samba start to start the services. That finally worked. I'm starting to now tinker around with the smb.conf and getting a feel for that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top