GentooIntroduction to Samba Part 2.docx
- 文档编号:12542878
- 上传时间:2023-06-06
- 格式:DOCX
- 页数:11
- 大小:20.92KB
GentooIntroduction to Samba Part 2.docx
《GentooIntroduction to Samba Part 2.docx》由会员分享,可在线阅读,更多相关《GentooIntroduction to Samba Part 2.docx(11页珍藏版)》请在冰点文库上搜索。
GentooIntroductiontoSambaPart2
Disclaimer:
TheoriginalversionofthisarticlewasfirstpublishedonIBMdeveloperWorks,andispropertyofWesttechInformationServices.Thisdocumentisanupdatedversionoftheoriginalarticle,andcontainsvariousimprovementsmadebytheGentooLinuxDocumentationteam.
Thisdocumentisnotactivelymaintained.
IntroductiontoSamba,Part2
1. Compiling,installing,andconfiguringSambaforyourenvironment
DownloadingSamba
OK,it'stimetodownloadSamba2.0.7orgreaterfromtheSamba.orgWebsite(seeResourceslaterinthisarticle).
Note:
WhileI'llbecompilingSambafromscratch,youmaychoosetoinstallSambafromabinarypackage(suchasRPMthatcamewithyourLinuxdistribution).ThisisperfectlyOK.But,asImentionedinmylastarticle,ifyoudothis,yourfilelocationsmaybeslightlydifferentthanwhatIrefertohere.
Afteryou'vedownloadedSamba2.0.7orgreater,it'stimetodecompressittoadirectorylocationofyourchoice.Fromthecommandprompt,type:
CodeListing 1.1:
Unpackingthesourcefiles
$tar-xzvfsamba-2.0.7.tar.gz
Asamba-2.0.7directorywillbecreated.cdintoit,andwe'lltakealookaround.First,noticethedocsdirectory.Insideityou'llseeanotherdirectorycalledtextdocs.texdocscontainsawholebunchofSambadocumentation.OneofthemostimportantfilesinthetextdocsdirectoryiscalledDIAGNOSIS.txt.Itwalksyouthroughastep-by-stepprocessofdiagnosingproblemsyoumayhavewithproperSambaoperation.We'llbecoveringsome,butnotall,ofthediagnosisproceduresmentionedinthisfile.
CompilingandinstallingSamba
You'llalsonoticethesourcesdirectoryinthemainsamba-2.0.7directory.Insidesourcesyou'llfindawelldesignedconfigurescriptdesignedtosetupallthemakefilesproperly.Aswithanyotherconfigurescript,togetalistoftheconfigurationoptions,type:
CodeListing 1.2:
Investigatingoptions
$./configure--help
Youwillprobablywanttopipetheoutputtomoresothatyoucanviewalltheoptions:
CodeListing 1.3:
Evenmoreoptions
$./configure--help|more
Notethedirectoryandfilenameoptions.Noticewhereeverythinggetsinstalled,andthatthedefaultinstallpathis/usr/local/samba.Youwillprobablywanttochangethisto/usr/localbypassingthe--prefix=/usr/localoptionwhenyouconfigureSamba.Forthisexample,I'mgoingtousethefollowingpathsettings:
CodeListing 1.4:
Configuringthedirectoryoptions
$./configure--prefix=/usr/local--localstatedir=/var/log--sysconfdir=/etc
TheaboveconfigurationoptionswillcauseSamba'sdefaulttreetobein/usr/local,withtheexceptionoftheconfigurationfiles.Sambawillexpecttofindthesein/etcandlogfiles,whichwillendupin/var/log.Ifyouomitthoseconfigureoptions,you'llfindeverythinginthe/usr/local/sambadirectorytree(/usr/local/samba/var,/usr/local/samba/etc,etc.).
It'snowtimetostartthecompilation.Afterrunningconfigure,type:
CodeListing 1.5:
CompilingSamba
$make
Aftercompilationcompletes,typethefollowingasroottoinstallthesoftware:
CodeListing 1.6:
InstallingSamba
#makeinstall
Configuringtheserver
Forthemostpart,configuringSambabeginsandendswiththesmb.conffile.ThisisSamba'smainconfigurationfile.Ithasmanydifferentconfigurationoptions.Toavoidconfusion,we'regoingtostartonlywiththoseoptionsessentialtotheproperoperationofSamba.First,you'llneedtofindoutwheresmb.confshouldbe.IfyouusedtheconfigurationoptionsIspecifiedabove,youshouldplacesmb.confin/etc.Ifyouusedthedefaultpaths,Sambawilllookforitin/usr/local/samba/etc.Togetstarted,cdtotheappropriatedirectory,fireupyourfavoritetexteditor,andtypeinthefollowinglines.I'llinterspersecommentaryalongthewaytoprovideyouwithagoodunderstandingofwhateachoptiondoes.Addtheselinestoyoursmb.conffile:
CodeListing 1.7:
smb.conf
[global]
workgroup=YOURWORKGROUP
security=user
encryptpasswords=yes
guestaccount=guest
ThefirstlinetellsSambathatweareplacingoptionsinthe"global"section.Therearemanyoptionsthatareintendedtobedefinedonlyinthissection.TheseoptionscontroltheglobalbehaviorofSamba.
ThesecondlinetellsSambathenameoftheWindowsworkgroupthatSambawillcreate.ReplaceYOURWORKGROUPwithanappropriatenameforyourworkgroup.
Onthethirdline,wetellSambatoruninuser-levelsecuritymode.ThisoptionwillcauseSambatotellallconnectingWindowsclientsthattheyneedtoprovideavalidusername/passwordcombinationtogainaccesstoanynetworkresource.Thisisdefinitelyagoodthing.User-levelsecurityisSamba'smostoftenusedsecuritylevelbecauseit'sanexcellentmatchforthemajorityoffilesharingsituations.However,thereareothersecuritylevelsavailable.OnehandymodetellsSambatoauthenticateallusersagainstthesecuritydatabaseofanexistingWindowsNTor2000Server.Wewon'tbecoveringthatparticularmodeinthisarticle.Ifyouwantmoreinformationaboutit,takealookatthe"security"optioninthesmb.confmainpage.
Now,ontothefourthline.HerewetellSambatoexchangepasswordswithSambainencryptedmode.YouwillalwayswanttorunSambainencryptedmode,unlessallyourclientmachinesareextremelyancient(likeWindowsforWorkgroups-eramachines).EnablingencryptedpasswordsdoescauseSambatoneeditsownpasswordfile,inadditiontothestandardUnixpassworddatabase.Ifyouarethinkingthatitmaybenicetoturnencryptedpasswordsoff,sothatyoucanavoidhavingtomaintaintwopasswordfiles,don'tdoit!
TurningencryptedpasswordsoffwillcausesharingproblemswithevenmoderatelyoldversionsofWindowsNT4.0inadditiontoWindows2000.Ifyoureallywanttoavoidmaintainingtwoseparatedatabases,Sambaprovidesseveralwaystosynchronizebothdatabases,whichisabetterapproach.
ThenextlinespecifiesavalidUnixuseraccountthatwillbeusedforguestaccess.Whilepeopleoftenuse"guestaccount=nobody",it'srecommendedthatyouaddaliteral"guest"usertoyoursystemifonedoesn'texistalready.Thenew"guest"accountdoesnotneedapasswordsetanddoesnotneedtobeabletologininteractively.(It'sfineifyoudochoosetoconfigureguestwithapasswordandavaliddefaultshell.)
Nowwe'rereadytoaddWINSsupportoptionstosmb.conf.You'llwanttoaddoneofthefollowingtwolinestotheglobalsection:
CodeListing 1.8:
WINSsupport
winssupport=yes
OR
CodeListing 1.9:
WINSserverIPaddress
winsserver=IPaddressofWINSserver
IfyoualreadyhaveaWINSserveronyourcurrentsubnet(aWindowsNTServerrunningWINS,forexample),you'llwanttousethesecondoptionandspecifythenameoftheWINSserverontherightsideoftheequalssign.Samba'sinternalWINSserviceswillthenbedisabled,anditwillusetheWINSserveryouspecify.
Ifyoudon'thaveaWINSserverrunningonyoursubnet,oryou'resettingSambaupathomeandyoudon'tknowexactlywhataWINSserveris,you'llwanttousethefirstoption.ThiswilltellSambatobecomeaWINSserverforyourLAN.
YoumaybewonderingwhatWINSdoes.Basically,youcanthinkofWINSasalocaldynamicDNSdatabase.WhenSambaisrunningasaWINSserver,everyWindows-compatiblemachineonthesamesubnetwillregisteritsIPaddressandNetBIOSname(a.k.a."computername")withSamba.ThisenablesWindowsmachinestouseSamba'sWINSdatabasetorequestanIPaddressforaparticularNetBIOSname.WINSisakeycomponentofnetworkbrowsing,whichiswhatyouaredoingwhenyoupokearoundinsidetheNetworkNeighborhoodonaWindowsmachine.
Nowwe'rereadytoaddseveralmoreoptionstotheglobalsection:
CodeListing 1.10:
Networkbrowsingsetup
localmaster=yes
oslevel=99
domainmaster=yes
preferredmaster=yes
Nowforanexplanation.Alltheseoptionsarerelatedtonetworkbrowsing.I'vealreadymentionedthatWINSisakeycomponentofnetworkbrowsing,butthere'sanotherelementrequiredforbrowsingtoworkproperly.Alocalmasterbrowsermustexist.Soundstrange?
Somefurtherexplanationisrequired.
Forbrowsingtoworkproperly,theremustbesomecentrallocationthatkeepstrackofwhatmachinesandworkgroupsexistonthelocalsubnet.Thisparticularlistiscalledthebrowselist.Thebrowselistisusedtoconstructthelistofworkgroups,domains,andmachinesyouseewhenyoufirstclickontheNetworkNeighborhood.AnymodernWindowsmachinecanbecomethelocalmasterbrowser.Ideally,we'dlikeSambatobethelocalmasterbrowseronthenetwork.
Howisthisaccomplished?
Basically,severalbeefyWindows-compatiblemachinesonyoursubnetwillregularlydukeitoutbyflingingpacketsbackandforthacrossyourLANinanattempttodeterminewhowillbecomethelocalmasterbrowser.Thisprocessiscalleda"browserelection."
Note:
Beagoodsport.Pleasedon'tuseSamba'sabilitytobeatWindowsinallbrowserelectionsasanexcusetoteaseMicrosoftadministratorsinyourorganization.Remember,it'simportanttobeagoodwinner.
Intheendthe"winner"ofthisbroadcastpacketwargetstobecomethelocalmasterbrowser.WecancauseSambatowinthebattlebyusingtheoslevel=99option,whichcausesittobeateveryothermachineontheLAN.ThishappensbecauseeveryversionofWindows(fromWindows95toNTto2000)hasahard-codedOSlevelthatwasintendedtocausethemostadvancedversionofWindowstobecomethelocalmasterbrowser(laterversionsofWindowshaveabiggernumber).SettingSambato99willcauseittobeatallMicrosoftproducts,allowingittobecomethelocalmaster
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- GentooIntroduction to Samba Part