Samba服務(wù)器配置和訪問Samba共享_第1頁
Samba服務(wù)器配置和訪問Samba共享_第2頁
Samba服務(wù)器配置和訪問Samba共享_第3頁
Samba服務(wù)器配置和訪問Samba共享_第4頁
Samba服務(wù)器配置和訪問Samba共享_第5頁
已閱讀5頁,還剩18頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

實(shí)訓(xùn)指導(dǎo)書三:Samba服務(wù)器配置及訪問Samba共享一.實(shí)訓(xùn)目的:.駕馭rpm吩咐安裝軟件包的方法.了解samba服務(wù)器的配置文件的編輯和運(yùn)用方法;.駕馭Samba服務(wù)器的安裝和配置方法;.運(yùn)用samba共享用戶認(rèn)證和文件系統(tǒng);.駕馭Linux與Windows的資源共享和互訪方法。.實(shí)訓(xùn)內(nèi)容:.利用rpm吩咐安裝軟件包的方法;.安裝、配置Samba服務(wù)器并啟動(dòng);.從Linux訪問Windows資源;.從Windows訪問Linux的資源;.Samba項(xiàng)目練習(xí)。.實(shí)訓(xùn)練習(xí):SMB協(xié)議和Samba簡介SMB協(xié)議為了使Windows主機(jī)間的資源能夠共享,微軟于1980年開發(fā)了SMB(ServerMessageBlock服務(wù)信息塊)通信協(xié)議,并通過SMB通信協(xié)議,使網(wǎng)絡(luò)上各臺(tái)主機(jī)之間能夠共享文件、打印機(jī)等資源;目前類似這種資源共享的通信協(xié)議還有NFS、Appletalk、Netware等。Samba簡介在局域網(wǎng)中,Windows主機(jī)彼此間可利用“網(wǎng)上鄰居”來訪問共享的資源,NFS也能使Linux主機(jī)之間實(shí)現(xiàn)資源共享。但如何能使Windows主機(jī)和Linux主機(jī)之間實(shí)現(xiàn)資源共享呢?設(shè)置當(dāng)Samba客戶端將帳號(hào)及密碼傳送到服務(wù)器端時(shí),是否實(shí)行密碼加密的方式??蛻舻牟僮飨到y(tǒng)假如是Windows95OSR2及NTSP3以后的版本,應(yīng)當(dāng)將此選項(xiàng)的值設(shè)為yes,默認(rèn)值為noosmbpasswdfile=/etc/samba/smbpasswd設(shè)置在Samba服務(wù)器上存放加密的密碼文件的位置(留意:Samba服務(wù)器與Linux采納不同的密碼文件)。2)設(shè)置共享資源參數(shù)comment針對(duì)共享資源所作的說明、注釋部分browseable設(shè)置用戶是否可以看到此共享資源。默認(rèn)值為yes,若將此參數(shù)設(shè)置為no,用戶雖然看不到此資源,但是擁有權(quán)限的用戶仍可干脆輸入該資源的網(wǎng)址來訪問該資源。writable設(shè)置共享的資源是否可以寫入。若共享資源是打印機(jī),則不需設(shè)置此參數(shù)設(shè)置可訪問的用戶。系統(tǒng)會(huì)自動(dòng)將%s轉(zhuǎn)換成登錄帳號(hào)。createmode設(shè)置文件的訪問權(quán)限,默認(rèn)值為0744。directorymode設(shè)置書目的訪問權(quán)限,默認(rèn)值為0755。path若共享資源是書目,則指定書目的位置;若為打印機(jī),則指定打印機(jī)隊(duì)列的位置。readonly設(shè)置共享資源是否只讀或可以寫入,默認(rèn)值為yes。若共享資源為打印機(jī)時(shí),此參數(shù)無任何意義。這一項(xiàng)與writable相反。Public等同于guestok選項(xiàng),表示是否允許用戶不運(yùn)用帳號(hào)和密碼便能訪問此資源。假如起用此功能,當(dāng)用戶沒有帳號(hào)和密碼時(shí),則會(huì)利用"guestaccount"”所設(shè)置的帳號(hào)名登錄。該選項(xiàng)默認(rèn)值為no,即不允許沒有帳號(hào)即密碼的用戶運(yùn)用此資源。avalible設(shè)置是否啟用此共享資源。默認(rèn)值為yes。若將此參數(shù)設(shè)置為no,則不管其他參數(shù)設(shè)置為什么,全部人均不得運(yùn)用此資源。validusers3)配置Samba文件共享舉例以下通過配置3個(gè)不同的共享書目為例,可以知道配置Samba文件共享的一般方法。[global]采納前面的[global]配置[homes]#用來配置用戶訪問自己的書目comment=HomeDirectories注釋browseable=no用戶私人書目,不給別人閱讀(并不是不允許別人訪問)writable=yes允許用戶寫入自己的書目validusers=%S可訪問的用戶局限于用戶自己。%s會(huì)被自動(dòng)轉(zhuǎn)換為登錄帳號(hào)。createmode=0664文件的訪問權(quán)限directorymode=0775書目的訪問權(quán)限Thisoneisusefulforpeopletosharefiles[tmp]這個(gè)部分為全部用戶供應(yīng)臨時(shí)共享的方式comment=Temporaryfilespace注釋文字path=/tmp指定位置readonly=no可以讀寫public=yes允許用戶不用帳號(hào)和密碼訪問[public]這個(gè)部分為全部用戶供應(yīng)可以共同訪問的書目。允許staff組用戶寫入,但其他用戶只可訪問,不能寫入。comment=PublicStuffpath=/home/sambapublic=yeswritable=yesprintable=nowritelist=@staffwritelist參數(shù)是用來設(shè)置具有寫權(quán)限的用戶列表。這里只允許staff組的成員有寫的權(quán)限[fredsdir]這個(gè)部分用來設(shè)置某一用戶fred的訪問權(quán)限。comment=Fred'sServicepath=/usr/fred/privatevalidusers=fred#只有fred可以訪問(留意:即使security=share,也不代表用戶登錄Linux主機(jī)后可以訪問隨意資源。)該共享書目public=nowritable=yesprintable=no任務(wù)四Linux資源共享與運(yùn)用項(xiàng)目1:四個(gè)用戶joe、karKmary和smith除了有他們自己的在服務(wù)器上的共享,這四位用戶同時(shí)在同一個(gè)部門工作并且須要一個(gè)地方來存儲(chǔ)部門的文件。我們將須要一個(gè)Linux用戶組,建立二個(gè)書目給這些用戶來存儲(chǔ)它們的內(nèi)容,/smb_test/public允許組中的用戶都可以寫,而/smb」est/legal只允許joe寫,且配置samba服務(wù)器來共享書目。?增加用戶組:#groupadd-g6000legal?增加用戶:#useradd-m-u5001-g6000#useradd-m-u5002-g6000karl#useradd-m-u5002-g6000karl#useradd-m-#useradd-m-u5003-g6000marysmith#useradd-m-u5004-g6000smith?修改用戶密碼:passwdjoepasswdkarlpasswdmarypasswdsmith建立書目:mkdir-p/smb_test/legalmkdir-p/smb_test/publie修改書目的組擁有者:chgrplegal./smb_test/legalchgrplegal/smb_test/public修改書目的擁有者:chownjoe/smb_test/legalchownkarl/smb_test/public修改書目的FAP:chmod770/smb_test/legalchmod770/smb_test/publie建立samba用戶密碼文件:cat/etc/passwd|mksmbpasswd.sh>/etc/samba/smbpasswd修改用戶samba密碼:smbpasswdjoesmbpasswdkarlsmbpasswdmarysmbpasswdsmith修改samba配置文件:ftgedit/etc/samba/smb.confThisisthemainSambaconfigurationfile.Youshouldreadthesmb.conf(5)manualpageinordertounderstandtheoptionslistedhere.Sambahasahugenumberofconfigurableoptions(perhapstoomany!)mostofwhicharenotshowninthisexampleAnylinewhichstartswitha;(semi-colon)ora#(hash)isacommentandisignored.Inthisexamplewewillusea#forcommentryanda;forpartsoftheconfigfilethatyoumaywishtoenableNOTE:Wheneveryoumodifythisfileyoushouldrunthecommand〃testparm〃tocheckthatyouhavenotmadeanybasicsyntacticerrors.=======================GlobalSettings=====================================[global]workgroup=NT-Domain-NameorWorkgroup-Nameworkgroup=MSHOMEserverstringistheequivalentoftheNTDescriptionfieldserverstring=SambaServerThisoptionisimportantforsecurity.Itallowsyoutorestrictconnectionstomachineswhichareonyourlocalnetwork.ThefollowingexamplerestrictsaccesstotwoCclassnetworksandthe"loopback"interface.Formoreexamplesofthesyntaxseethesmb.confmanpagehostsallow=192.168.1.192.168.2.127.ifyouwanttoautomaticallyloadyourprinterlistratherthansettingthemupindividuallythenyou'11needthisprintcapname=/etc/printcaploadprinters=yesItshouldnotbenecessarytospellouttheprintsystemtypeunlessyoursisnon-standard.Currentlysupportedprintsystemsinclude:bsd,sysv,pip,Iprng,aix,hpux,qnx,cupsprinting=cupsUncommentthisifyouwantaguestaccount,youmustaddthisto/etc/passwd#otherwisetheuser"nobody"isused;guestaccount=pcguestthistellsSambatouseaseparatelogfileforeachmachinethatconnectslogfile=/var/log/samba/%m.logPutacappingonthesizeofthelogfiles(inKb),maxlogsize=80Securitymode.Mostpeoplewillwantuserlevelsecurity.Seesecurity_level.txtfordetails,security=userUsepasswordserveroptiononlywithsecurity=serverTheargumentlistmayinclude:passwordserver二My_PDC_Name[MyBDCName][My_Next_BDC_Name]ortoauto-locatethedomaincontroller/spasswordserver=*; passwordserver=<NT-Server-Name>PasswordLevelallowsmatchingof_n_charactersofthepasswordfor#allcombinationsofupperandlowercase.;passwordlevel=8;usernamelevel=8Youmaywishtousepasswordencryption.PleasereadENCRYPTION,txt,Win95.txtandWinNT,txtintheSambadocumentation.Donotenablethisoptionunlessyouhavereadthosedocumentsencryptpasswords=yessmbpasswdfile=/etc/samba/smbpasswdThefollowingisneededtokeepsmbclientfromspoutingspuriouserrors#whenSambaisbuiltwithsupportforSSL.;sslCAcertFile二/usr/share/ss1/certs/ca-bundle.crtThefollowingareneededtoallowpasswordchangingfromWindowstoupdatetheLinuxsystempasswordalso.NOTE:UsethesewithJencryptpasswords'andJsmbpasswdfile'above.N0TE2:YoudoNOTneedthesetoallowworkstationstochangeonlytheencryptedSMBpasswords.TheyallowtheUnixpasswordtobekeptinsyncwiththeSMBpassword.unixpasswordsync=Yespasswdprogram=/usr/bin/passwd%upasswdchat=*New*password*%n\n*Retype*new*password*%n\npasswd:*all*authentication*tokens*updated*successfully*YoucanusePAM'spasswordchangecontrolflagforSamba.Ifenabled,thenPAMwillbeusedforpasswordchangeswhenrequestedbyanSMBclientinsteadoftheprogramlistedinpasswdprogram.Itshouldbepossibletoenablethiswithoutchangingyourpasswdchatparameterformostsetups.pampasswordchange=yesUnixuserscanmaptodifferentSMBUsernames;usernamemap=/etc/samba/smbusers#Usingthefollowinglineenablesyoutocustomiseyourconfiguration#onapermachinebasis.The%mgetsreplacedwiththenetbiosname#ofthemachinethatisconnecting;include=/etc/samba/smb.conf.%mThisparameterwillcontrolwhetherornotSambashouldobeyPAM'saccountandsessionmanagementdirectives.ThedefaultbehavioristousePAMforcleartextauthenticationonlyandtoignoreanyaccountorsessionmanagement.NotethatSambaalwaysignoresPAMforauthenticationinthecaseofencryptpasswords=yesobeypamrestrictions二yesMostpeoplewillfindthatthisoptiongivesbetterperformance.Seespeed,txtandthemanualpagesfordetailssocketoptions=TCP^NODELAYSO_RCVBUF=8192SO_SNDBUF=8192ConfigureSambatousemultipleinterfacesIfyouhavemultiplenetworkinterfacesthenyoumustlistthemhere.Seethemanpagefordetails.Configureremotebrowselistsynchronisationhererequestannouncementto,orbrowselistsyncfrom:aspecifichostorfrom/toawholesubnet(seebelow)CausethishosttoannounceitselftolocalsubnetshereBrowserControlOptions:setlocalmastertonoifyoudon,twantSambatobecomeamasterbrowseronyournetwork.Otherwisethenormalelectionrulesapply;localmaster=no#OSLeveldeterminestheprecedenceofthisserverinmasterbrowser#elections.Thedefaultvalueshouldbereasonableoslevel=33DomainMasterspecifiesSambatobetheDomainMasterBrowser.ThisallowsSambatocollatebrowselistsbetweensubnets.Don,tusethisifyoualreadyhaveaWindowsNTdomaincontrollerdoingthisjob;domainmaster=yesPreferredMastercausesSambatoforcealocalbrowserelectiononstartupandgivesitaslightlyhigherchanceofwinningtheelection;preferredmaster=yesEnablethisifyouwantSambatobeadomainlogonserverforWindows95workstations.;domainlogons二yesifyouenabledomainlogonsthenyoumaywantaper-machineorperuserlogonscriptrunaspecificlogonbatchfileperworkstation(machine);logonscript=%m.batrunaspecificlogonbatchfileperusername;logonscript=%U.batWheretostorerovingprofiles(onlyforWin95andWinNT)%Lsubstitutesforthisserversnetbiosname,%UisusernameYoumustuncommentthe[Profiles]sharebelow;logonpath=\\%L\Profiles\%UWindowsInternetNameServingSupportSection:WINSSupport-TellstheNMBDcomponentofSambatoenableit'sWINSServer;winssupport=yesWINSServer-TellstheNMBDcomponentsofSambatobeaWINSClientNote:SambacanbeeitheraWINSServer,oraWINSClient,butNOTbothWINSProxy-TellsSambatoanswernameresolutionqueriesonbehalfofanonWINScapableclient,forthistoworktheremustbeatleastoneWINSServeronthenetwork.ThedefaultisNO.;winsproxy=yesDNSProxy-tellsSambawhetherornottotrytoresolveNetBIOSnamesviaDNSnslookups.Thebuilt-indefaultforversions1.9.17isyes,thishasbeenchangedinversion1.9.18tono.dnsproxy=no微軟的“網(wǎng)上鄰居”就是Windows上利用SMB通信協(xié)議實(shí)現(xiàn)資源共享的程序。通過運(yùn)用“網(wǎng)上鄰居”,用戶在網(wǎng)上共享資源的操作簡潔便利。有鑒于此,Linux愛好者起先在Linux主機(jī)上實(shí)現(xiàn)SMB通信協(xié)議。Samba是用來實(shí)現(xiàn)SMB的一種軟件,由澳大利亞的AndewTridgell開發(fā),是一種在Linux環(huán)境里運(yùn)行的自由軟件。Samba的工作原理是讓NetBIOS和SMB運(yùn)行在TCP/IP之上,且運(yùn)用NetBIOS的nameserver讓Linux機(jī)器可以在Windows網(wǎng)絡(luò)鄰居里被閱讀。它使得Windows主機(jī)和Linux主機(jī)之間實(shí)現(xiàn)了資源共享。1.3Samba軟件的功能SMB通信協(xié)議采納的是Client/Server架構(gòu),因此Samba軟件可以分為客戶端和服務(wù)器端兩部分。通過執(zhí)行Samba客戶端程序,Linux主機(jī)便可以運(yùn)用網(wǎng)絡(luò)上Windows主機(jī)所共享的資源;而在Linux主機(jī)上安裝Samba服務(wù)器,則可以使Windows主機(jī)訪問LinuxSamba服務(wù)器共享的資源Samba供應(yīng)了以下功能:(1)共享Linux的文件系統(tǒng)(2)共享安裝在Samba服務(wù)器上的打印機(jī)(3)運(yùn)用Windows系統(tǒng)共享的文件和打印機(jī)(4)支持Windows域限制器和Windows成員服務(wù)器對(duì)運(yùn)用Samba資源的用戶進(jìn)行認(rèn)證(5)支持WINS名字服務(wù)器解析及閱讀(6)支持SSL平安套接層協(xié)議2.Samba實(shí)訓(xùn)在本次試驗(yàn)起先之前,請(qǐng)確保把Linux的防火墻規(guī)劃清掉,讓相應(yīng)的端口通過。任務(wù)一Samba安裝和啟動(dòng)檢測(cè)系統(tǒng)是否安裝了samba服務(wù),假如沒有安裝掛載Linux第一張安裝光盤,利用rpm—ivh吩咐安裝samba,samba-common和samba-clientRPM軟件包并且啟動(dòng)smb服務(wù)。任務(wù)一步驟:1)假如用戶在安裝Linux時(shí)已經(jīng)安裝了Samba,就無需再安裝了,可以通過下列吩咐確定是否已經(jīng)安裝了Samba。查詢系統(tǒng)是否安裝Samba:CasePreservationcanbehandy-systemdefaultis_no_NOTE:Thesecanbesetonapersharebasis;preservecase=no;shortpreservecase=no#DefaultcaseisnormallyuppercaseforallDOSfiles;defaultcase=lowerBeverycarefulwithcasesensitivity-itcanbreakthings!;casesensitive=no============================ShareDefinitions================[homes]comment=HomeDirectoriesbrowseable=nowritable=yesvalidusers=%Screatemode=0664directorymode=0775Ifyouwantuserssambadoesn,trecognizetobemappedtoaguestuser;maptoguest二baduserUn-commentthefollowingandcreatethenetlogondirectoryforDomainLogons;[netlogon];comment二NetworkLogonService;path=/usr/local/samba/1ib/netlogon; guestok=yes; writable二no;sharemodes=noUn-commentthefollowingtoprovideaspecificrovingprofilesharethedefaultistousetheuser'shomedirectory;[Profiles]; path二/usr/local/samba/profiles; browseable=no; guestok=yesNOTE:IfyouhaveaBSD-styleprintsystemthereisnoneedtospecificallydefineeachindividualprinter[printers]comment=AllPrinterspath=/var/spool/sambabrowseable=noSetpublic=yestoallowuserJguestaccount,toprintguestok=nowritable=noprintable=yesThisoneisusefulforpeopletosharefiles;Ltmp];comment=Temporaryfilespace; path=/tmp; readonly=no;public=yesApubliclyaccessibledirectory,butreadonly,exceptforpeopleinthe"staff"group[public]comment=PublicStuffpath=/smb_test/publicpublic=nocreatemask=0660printable=nowritelist=@legalOtherexamples.Aprivateprinter,usableonlybyfred.Spooldatawillbeplacedinfeed'shomedirectory.Notethatfredmusthavewriteaccesstothespooldirectory,#whereveritis.;[fredsprn]; comment=Fred,sPrinter; validusers=fred;path=/home/fred;printer=freds_printer; public=no; writable=no;printable=yesAprivatedirectory,usableonlybyfred.Notethatfredrequireswrite#accesstothedirectory.;[fredsdir];comment=Fred,sService;path=/usr/somewhere/private; validusers二fred; public=nowritable=yesprintablenoprintablenoaservicewhichhasadifferentdirectoryforeachmachinethatconnects#thisallowsyoutotailorconfigurationstoincomingmachines.Youcould#alsousethe%Uoptiontotailoritbyusername.The%mgetsreplacedwiththemachinenamethatisconnecting.;[pchome];comment二PCDirectories;path=/usr/local/pc/%m;public二no;writable=yesApubliclyaccessibledirectory,read/writetoallusers.Notethatallfiles#createdinthedirectorybyuserswillbeownedbythedefaultuser,so#anyuserwithaccesscandeleteanyotheruser'sfiles.Obviouslythis#directorymustbewritablebythedefaultuser.Anotherusercouldofcourse#bespecified,inwhichcaseallfileswouldbeownedbythatuserinstead.;[public]; path二/usr/somewhere/else/public; public=yes; onlyguest=yes; writable=yes; printable=noThefollowingtwoentriesdemonstratehowtoshareadirectorysothattwouserscanplacefilestherethatwillbeownedbythespecificusers.Inthis#setup,thedirectoryshouldbewritablebybothusersandshouldhavethe#stickybitsetonittopreventabuse.Obviouslythiscouldbeextendedto#asmanyusersasrequired.[legal]comment=Legal'sfilespath=/smb_test/legalvalidusers=?legalpublic=nocreatemask=0660writelist=joe?存儲(chǔ)samba配.?重啟samba服務(wù):/etc/init.d/smbrestart或servicesmbrestart?確認(rèn)Linux虛擬機(jī)和Windows?確認(rèn)Linux虛擬機(jī)和Windows主機(jī)配:I,?上itfi;在一個(gè)網(wǎng)段上,網(wǎng)絡(luò)連接正常?在Windows系統(tǒng)中運(yùn)行:項(xiàng)目2:Geecy軟件開發(fā)公司即將起先在Linux系統(tǒng)上進(jìn)行兩個(gè)項(xiàng)目的開發(fā)。開發(fā)人員David和Peter組成一個(gè)小組,負(fù)責(zé)A項(xiàng)目的開發(fā);開發(fā)人員Jack和Mike組成另一個(gè)小組,負(fù)責(zé)B項(xiàng)目的開發(fā)。系統(tǒng)管理員Ray須要為這四名開發(fā)人員分別建立用戶帳號(hào),配置samba服務(wù)器并滿意以下要求:(1)建立書目“/project_a",該書目里面的文件只能由David和Peter兩人讀取、增加、刪除、修改以及執(zhí)行,其他用戶不能對(duì)該書目進(jìn)行任何的訪問操作;(2)建立書目“/project)“,該書目里面的文件只能由Jack和Mike兩人讀取、增加、刪除、修改以及執(zhí)行,其他用戶不能對(duì)該書目進(jìn)行任何的訪問操作;(3)建立書目“/project”,該書目里面的文件只能由David、Peter、Jack和Mike四人讀取、增加、刪除、修改以及執(zhí)行,其他用戶只可以對(duì)該書目進(jìn)行只讀的訪問操作。rpm-qa|grepsamba若出現(xiàn)這5個(gè)軟件包,則表示已經(jīng)安裝了Samba,否則必需安裝Samba。2)單擊菜單欄“虛擬機(jī)”,選擇“可移動(dòng)設(shè)備一>CD?ROM”,載入第一張ISO映像文件,例如:D:\RedHatLinux_ISOFiIes\RedHatLinux9J386_discl.iso,將光盤掛載到/mnt/cdrom書目;mount/dev/cdrom/mnt/cdrom3)切換到放置rpm文件的書目;cd/mnt/cdrom/RedHat/RPMS4)Samba必備的程序,必需安裝;5)安裝Samba服務(wù)器程序,可以使Windows主機(jī)訪問Samba服務(wù)器共享的資源;6)安裝Samba客戶端程序,可以使Linux主機(jī)訪問Windows主機(jī)上的共享資源;或者4),5)和6)合為如下操作:rpm-ivh/mnt/cdrom/RedHat/RPMS/samba-c^rpm-ivh/mnt/cdrom/RedHat/RPMS/samba-2*7)啟動(dòng)smb服務(wù);#servicesmbstart當(dāng)能看到下面的顯示,就表示啟動(dòng)勝利。StartingSMBservice [確定]StartingNMBservice[確定]StartingNMBservice[確定]啟動(dòng)smb服務(wù)也可以運(yùn)用吩咐:#/etc/init.d/smbstart8)停止smb服務(wù);#servicesmbstop或者:/etc/init.d/smbstop8)重啟smb服務(wù)/etc/init.d/smbrestart或^■:#servicesmbrestart任務(wù)二Windows資源共享與運(yùn)用1.Windows資源共享:1)運(yùn)用TCP/IP協(xié)議作為Windows系統(tǒng)網(wǎng)絡(luò)默認(rèn)通訊協(xié)議;2)在主機(jī)Windows操作系統(tǒng)中的DOS吩咐模式下運(yùn)行ipconfig/all指令得到本地連接的IP地址和子網(wǎng)掩碼,例如:;3)在虛擬機(jī)中以root用戶登錄,確保把Linux的防火墻規(guī)劃清掉。啟動(dòng)終端,運(yùn)用ifconfig指令對(duì)虛擬機(jī)的網(wǎng)絡(luò)地址進(jìn)行配置,將虛擬機(jī)和主機(jī)配置在一個(gè)網(wǎng)段:(詳細(xì)地址視實(shí)際狀況而定);#manifconfig(查看ifconfig吩咐的用法)#ifconfig(查看當(dāng)前虛擬網(wǎng)卡配置)#ifconfigethO6netmask(配置當(dāng)前虛擬網(wǎng)卡)#ifconfigethOup(啟動(dòng)網(wǎng)絡(luò)連接)假如能ping通,表明連接正常。假如不能ping通,檢查Windows主機(jī)防火墻配置(是否防止Ping入);4)設(shè)置好Windows系統(tǒng)計(jì)算機(jī)名(例如:WINSERVER)和所屬工作組(例如:WORKGROUP);6)在Windows系統(tǒng)建立文件夾smb_win_test,運(yùn)用寫字板建立文件windows_test.txt,,內(nèi)容為:“ThisisafilefortheLinuxsmbtest!”,共享文件夾smb_win_test;7)在Windows系統(tǒng)建立用戶test,密碼為:“123456”Windows共享資源的運(yùn)用:1)確認(rèn)Linux虛擬機(jī)和Windows主機(jī)配置在一個(gè)網(wǎng)段上,網(wǎng)絡(luò)連接正常;2)在Linux虛擬機(jī)上啟動(dòng)smb服務(wù);servicesmbstart當(dāng)能看到下面的顯示,就表示啟動(dòng)勝利;StartingSMB service [確定]StartingNMB service [確定]3)在Linux計(jì)算機(jī)上,執(zhí)行以下吩咐;將在Linux計(jì)算機(jī)上列表顯示出Windows系統(tǒng)計(jì)算機(jī)WINSERVER所供應(yīng)的全部共享信息;4)在Linux計(jì)算機(jī)上,執(zhí)行以下吩咐;smbclient//1其中test是Windows計(jì)算機(jī)上的用戶,系統(tǒng)提示輸入test的密碼,輸入“123456”,密碼驗(yàn)證正確后,系統(tǒng)提示:smb:>此時(shí)表明已正確登錄到Samba服務(wù)器上,可以用smbclient的指令,象用FTP指令一樣上傳和下載文件。smbclient吩咐說明吩咐?或helpEcommand]!吩咐?或helpEcommand]![shellcommand]cd[書目]led[書目]dir或Isexit或quit供應(yīng)關(guān)于幫助或某個(gè)吩咐的幫助;執(zhí)行所用的SHELL吩咐,或讓用戶進(jìn)入SHELL提示符;切換到服務(wù)器端的指定書目,如未指定,則返回當(dāng)前本地書目;切換到客戶端指定的書目;列出服務(wù)器端當(dāng)前書目下的文件;退出smbclient;getfilelfile2mgetfilelfile2file3filenmd或mkdir書目rd或rmdir書目從服務(wù)器上下載filel,并以文件名file2從服務(wù)器上下載filel,并以文件名file2存在本地機(jī)上;假如不想改名,可以把file2省略;從服務(wù)器上下載多個(gè)文件;在服務(wù)器上創(chuàng)建書目;刪除服務(wù)器上的書目向服務(wù)器上傳一個(gè)文件filel,傳到服務(wù)器上改名為file2;mputfilelfile2filen向服務(wù)器上傳多個(gè)文件5)運(yùn)用md吩咐在Windows服務(wù)器上建立“passwd_bak”書目,將Linux系統(tǒng)中/etc/passwd,/etc/group和/etc/shadow等3個(gè)文件上傳到Windows服務(wù)器的upasswd_bakv書目中,在Windows系統(tǒng)中運(yùn)用寫字板查看這3個(gè)文件。寫出操作吩咐和過窗并加以驗(yàn)證。6)在Linux系統(tǒng)中/root書目下建立書目/smb_linux_test,將Widows系統(tǒng)中在“smb_win_test”書目下的文件windows_test.txt卜載到本機(jī)/root/smb_linux_test書目下,更命為windows_test_to_linux.txt,在Linux系統(tǒng)中運(yùn)用gedit查看這個(gè)文件。寫出操作吩咐和過程,笄加以驗(yàn)證。7)運(yùn)用smbmount吩咐知道某臺(tái)主機(jī)所共享的資源后,執(zhí)行smbmonut吩咐將遠(yuǎn)程共享掛載到本地。先創(chuàng)建掛載點(diǎn)書目:mkdir-p/mnt/smb/win_share_dir將遠(yuǎn)程共享〃掛載到本地書目/mnt/smb/win_share_dirsmbmount///smb_win_test/mnt/smb/win_share_dircd/mnt/smb/win_share_dir這樣就可以象訪問本機(jī)書目一樣操作此掛載的書目了。若要卸載已掛載的書目,則執(zhí)行umount吩咐即可。umount/mnt/smb/win_share_dir任務(wù)三samba服務(wù)器的配置文件的編輯和運(yùn)用方法Samba最主要的配置文件是

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論