You are on page 1of 3

Samba in 10 Minutes, By Steve Litt

From: http://www.troubleshooters.com/tpromag/199910/199910.htm Note: If accessing from Win98, the following W!" nee#s to be put in the registr$: %nable&lain'e(t&asswor# &ut it in: )*%+,-!./-,0/.)IN%12$stem1.urrent.ontrol2et12er3ices14( 14N%'25& -et6s assume $ou ha3e a networ7 in place an# $our Win#ows an# -inu( bo( can ping each other. If $ou63e ne3er set up 2amba, create this proof of concept smb.conf after backing up your existing /etc/smb.conf: encrypt passwords=yes workgroup=Seaside netbios name=LinuxBox [homes] Italici8e# workgroupname shoul# be replace# with the wor7group name from $our Win#ows bo(6s networ7ing properties:I#entification tab:Wor7group fiel#. 5se the same case as on that fiel#. Italici8e# servername shoul# be replace# with $our -inu( bo(6s name, as re3eale# b$ the hostname comman#, less an$ #omain name suffi(es. 5se the same case as re3eale# b$ hostname. For instance, if hostname #ispla$e# myserver.mydomain.cxm, $ou woul# simpl$ replace servername with myserver. Ne(t set $ourself up as a user on the 2amba ser3er. -et6s sa$ $ou use username m$ui# on the Win#ows bo(. )ere6s what $ou #o: useradd myuid passwd myuid smbpasswd -a myuid /ll passwor#s shoul# be the same as the one on the Win#ows &.. While the$ can be #ifferent, on a first tr$ it6s best to 7eep all passwor#s for m$ui# the same. Now restart 2amba. 'he comman# is slightl$ #ifferent on #ifferent -inu( #istros. )ere6s a partial list: rcsmb start starts the ser3ice rcsmb stop stops the ser3ice Now start Win#ows %(plorer, an# browse from Networ7 Neighborhoo# to 9%ntire Networ79 to groupname to servername to $our username, an# browse. +ou6ll notice $ou6re actuall$ browsing $our 5ni( bo(6s home #irector$. 'his is the result of the :homes; share $ou place# in smb.conf.

Troubles ooting ! "oes Samba #ork on t e Server$


When confronte# with a 2amba problem, it ta7es ma$be < minutes to isolate it to a subs$stem. i3i#e an# con=uer. 'he first =uestion is 9#oes 2amba wor7 on the -inu( bo( itself9. 'r$ to access the homes share from the 5ser I $ou use on the Win#ows bo(: smbclient LinuxBox homes -!bruce >e sure to use the same user i# as on the Win#ows bo( after the ?5. 'his will prompt $ou for a passwor#, an# if properl$ supplie# will #rop $ou to an smb: 1@ prompt, from which $ou can #o comman#s li7e ls to pro3e $ou6re seeing the home #irector$. !b3iousl$, #o no puts or #eletes. [root"mainserv etc]# smbclient linuxbox working -!bruce $dded inter%ace ip=&'(.&)*.&++.&+, bcast=&'(.&)*.&.(,, nmask=(,,.(,,.(,,.+ -assword. /omain=[S0$S1/0] 2S=[!nix] Server=[Samba (.(.,] smb. 34 Now test browsing abilit$ with this comman#: smbclient -5L linuxbox shoul# return an$ browseable shares, something li7e this: [root"mainserv etc]# smbclient -5L servername $dded inter%ace ip=&'(.&)*.&.&+, bcast=&'(.&)*.&.(,, nmask=(,,.(,,.(,,.+ /omain=[S0$S1/0] 2S=[!nix] Server=[Samba (.(.,] Sharename --------working customer homes 1-78 Server --------6ype ---/isk /isk /isk 1-7 7omment ------6he working partition 2ur customers 1-7 Service 9Samba (.+.:; 7omment -------

SERVERNAME <orkgroup --------MYGROUP

Samba 2.0.3 nothing shows here =aster ------another b!an"

'he prece#ing pro3e# 2amba is running an# browseable, at least from the -inu( bo( itself. Note that if a share that shoul# be browseable an# is not, an# if the following test succee#s, $ou probabl$ ha3e a browsabilit$ problem in smb.conf. 0a7e sure the share has a browseable=yes, an# use testparm to ma7e sure that the global section has or #efaults to browse list=yes. It6s also han#$ to place browseable=yes in the global section. If, after the abo3e reme#iation attempts, either of the pre3ious smbclient tests is still failing, continue on to !ther 2er3er 'ests. !therwise, .ontinue on to oes 2amba Wor7 on the Win#ows .lientA.

%t er Server Tests
If both the pre3ious tests wor7e# correctl$, the problem is not on $our -inu( bo( or 2amba setup. It6s either in $our networ7 or $our Win#ows bo(. )owe3er, if the$ #on6t wor7, the problem is on $our -inu( bo(, so $ou6ll nee# more tests: tests $our /etc/smb.conf for errors, an# #ispla$s such errors an# warnings. Fi( all errors an# testparm warnings before further troubleshooting. .hec7s for a running smb#. Without one, 2amba #oesn6t wor7. If no smb# is foun#, restart samba ps a( B grep as #escribe# in the 2amba in 10 0inutes article. If it won6t restart correctl$, troubleshoot CthatC smb# problem before continuing. .hec7s for a running nmb#. Without one, 2amba #oesn6t wor7. If no nmb# is foun#, restart samba ps a( B grep as #escribe# in the 2amba in 10 0inutes article. If it won6t restart correctl$, troubleshoot CthatC nmb# problem before continuing. ping the ser3er6s 5suall$ a loss of networ7 connecti3it$ will not pre3ent local 2amba usage, but this is too eas$ a test I& a##ress to ignore. Fi( this connecti3it$ problem before continuing. !nce smbclient can browse an# access shares on the -inu( bo(, it6s time to troubleshoot from Win#ows.

"oes Samba #ork on t e #in&o's (lient$


Without connecti3it$ $ou cannot use 2amba Dnor an$ other networ7 appE. Fi( this connecti3it$ problem before continuing. 'his accesses the home #irector$. Without this abilit$ $ou cannot browse nor use 2amba in an$ wa$. If this fails where smbclient 6//ser3ername/homes6 ?5m$ui# succee#e# on the ser3er, it points to a net use C 11linu(bo(1wor7ing problem with the username or netbios naming. >e sure $ou ha3e a 3ali# netbios nameFser3ername line in the global portion of $our smb.conf. 0a7e sure that $ou63e entere# the same username an# passwor# through smbclient that $ou6re using on the Win#ows machine. 'his tests browsing abilit$. 'his is 3er$ unli7el$ to fail if the pre3ious test an# the browsing test on the -inu( bo( succee#e#. )owe3er, if this is the case, troubleshoot as necessar$. Note that Win9( has browsing problems net 3iew 11linu(bo( in Win#ows %(plorer, so if this succee#s where Win#ows %(plorer faile#, it6s a problem with Win9(6s %(plorer6s interaction with 2amba. Note that Win N' #oes not ha3e these problems. 'his often #oesn6t wor7 e3en though the net 3iew 11ser3ername #oes. In browse Win#ows %(plorer/networ7 this case it6s a problem with %(plorer nee#ing a master browser but not neighborhoo#/wor7group/ser3ername/user triggering an election for one. 2ee the section on triggering a browser name for the home #irector$. election. ping the ser3er6s I& a##ress

Triggering a Bro'ser )lection


+ou can often trigger a browser election from Win#ows 9( with this comman#: net view workgroup.wor"gro#$name From Win#ows N' use this comman#: net view domain.wor"gro#$name /n# to trigger an election upon 2amba startup, inclu#e the following in the global portion of smb.conf: pre%erred master=yes 'o trigger an election on 2amba startup an# prett$ much guarantee that the 2amba ser3er will become the main browser, a## the following lines to the global portion of smb.conf: pre%erred master=yes

os level=), local master=yes domain master=yes 5suall$ a browser election is won within G0 secon#s of the e3ent starting it. +ou can real?time witness the winning of a browser election b$ 3iewing the output of the this comman#: tail -% log.nmb Note that log.nmb is in #ifferent places in #ifferent #istros. !n "e# )at H it6s in /3ar/log/samba.

"*+,-%S*S.txt
'his article6s purpose was prett$ much to e(plain preliminar$ 2amba troubleshooting in #i3i#e an# con=uer terms. )owe3er, the correct wa$ in the 2amba worl# is to follow /n#rew 'ri#gell6s pre#efine# #iagnostic locate# in file I/IN!2I2.t(t, which is a3ailable in the #istribution #ocumentation. !n "e# )at H it6s at /usr/#oc/samba?<.0.G/#ocs/te(t#ocs/ I/IN!2I2.t(t. Follow this ten step pre#efine# #iagnostic, an# #o not continue past a step that fails. If $ou get stumpe# an# nee# tech support, be sure to sen# them the results $ou obtaine# in this pre#efine# #iagnostic.

.iner Testing
'he testing in this article an# in I/IN!2I2.t(t helps $ou narrow the problem to the nearest subs$stem within two minutes. !ften other steps are necessar$ to further narrow it. '$picall$ these in3ol3e e#iting smb.conf an# restarting samba. &lease 7eep in min# that the easiest, =uic7est an# most reliable tests in3ol3e small smb.conf files, not a <00 line whopper. "emember stan#ar# 'roubleshooting tactics such as #i3i#e an# con=uer, fin#ing commonalities, an# e(ploiting #ifferences. If it6s a li3e ser3er that cannot be restarte# or e(perimente# with, tr$ to repro#uce the problem on a #ifferent machine an# troubleshoot it there.

/seu&o /rinter Server Si&e +utomation


&rinter shares are #esignate# simpl$ b$ the e(istence of a print ok=yes Dor printable=yesE. )ere6s the simplest possible printer share that creates no warnings in testparm: [myprint] print ok=yes path= var spool samba printer name=lp browseable=yes 'his ma7es a printer calle# m$print 3isible in networ7 neighborhoo#. It prints to the 5ni( printcap printer name# lp, an# it temporaril$ spools files in #irector$ /3ar/spool/samba. oubleclic7ing this printer in Win#ows allows $ou to create a Win#ows printer #efinition for it, thus ma7ing it printable from within Win#ows applications. !r e3en without #oing that, $ou can simpl$ use this comman#: echo 9)ello Worl#J-9 B 11m$ser3er1m$print 'his will print the phrase )ello Worl# on a page, an# because of the formfee# char at the en#, will formfee# the printer. Note this all assumes that printcap printer lp is a straight through te(t printer. 2o much for the 2amba printer re3iew. 2amba printing is not roc7et science. What the$ reall$ #o is call a comman#, calle# the 9print comman#9, represente# b$ the print command= smb.conf parameter. 5sing testparm > grep -i ?print command? $ou can fin# the #efault print comman#, which is usuall$ something li7e this: print command = lp -c -d@p @sA rm @s )ere @p is a substitution macro for the ser3ice6s home #irector$, while the @s is a substitution macro for the file to be printe#. 'here6s nothing to sa$ the print comman# nee# in3ol3e lpB lpr, or an$ other print relate# comman#. It can be an$thing. )ence the pseu#o printer. 2o let6s change it a little b$ a##ing our own print comman#: [myprint] print ok=yes path= var spool samba printer name=lp browseable=yes print command=. unixprocess @s Now the file goes to the uni(process program D3ia comman# line argE instea# of to the printer. 2o if $our Win#ows process creates a file calle# 100<c.t(t, after writing an# closing that file it can spawn the uni( process to be run on that file with this simple comman# Dassuming the Win#ows process to be a . programE: system9?copy &++(c.txt 3333myserver33myprint?;A Note the #ouble bac7slashes are a .6ism, an# that if $ou printe# that comman# #irectl$ on the comman# line it woul# loo7 li7e this: copy &++(c.txt 33myserver3myprint 'he 7ing of all 2amba man pages is man smb.con%. !ther highl$ 3aluable ones are the smbd, nmbdB smbpasswd, an# smbclient.

You might also like