《linux管理及应用chap13sambaN》由会员分享,可在线阅读,更多相关《linux管理及应用chap13sambaN(20页珍藏版)》请在金锄头文库上搜索。
1、Talking to Windows with SambaCritical SkillnUnderstand mechanics of SMBnPerform Samba administrationnUse smbclient and smbmountnAccess share files between Windows and Linux systemsnSecurity levels for samba clientThe way in which SMB worksWhat is SMB?nSMB, which stands for Server Message Block, is a
2、 protocol for sharing files, printers, and serial ports between computers. What is Sambana software suit allowing Unix-based systems (such as Linux) to interoperate with Windows-based systemsnprovides file and print service to all of manner of SMB clients, including numerous version of Microsoft Win
3、dows operating systems (为SMB用户提供文件和打印共享的服务)Network Topology for Samba ServerSambaSMBClientSambaSMBClientSMBClientnSamba Samba daemons:daemons:smbd and nmbdnnmdb daemon lets other computer browse Linux service through port 139nsmbd daemon makes remote Windows system possible to access Linux system th
4、rough port 137 or 138Configuration File for Samban/etc/samba/smb.conf : service configuration file (samba 的服务配置文件)nCheck samba status n/etc/rc.d/init.d/smb statussmbd (pid 1005) is runningnmbd (pid 1016) is runningnStart, stop, restartnStructure of Samba smb.conf nGlobal: basic configuration and sha
5、ring resource (服务器的基本设置和共享资源的设置)nHomes: set up a home directory for Samba server (设置访问Samba服务器的用户主目录)n Printers:Set up a sharing printer (设置Linux主机上共享的打印机)nUserdefined_ShareName: sharing directories (设置用户共享目录) nSecurity level for Samba usersnShare: logon system without checking user account and pass
6、wordnUser: need to provide user account and password when accessingConfigure Samba ServernStep1: Create samba accounts (add samba user) for all users existed#cat /etc/passwd | mksmbpasswd.sh /etc/samba/smbpasswdnStep2: Create a samba account for each useryou may add a new user with “useradd” and use
7、 smbpasswd to create samba passwd if the user does not exist.you may use smppasswd a user to create a samba user account.nStep3: Modify /etc/samba/smb.conf nmake sharing filen/etc/samba/smbusers /allow Linux users map to SMB usern#smbclient L host /show sharing resource, no passwd neededtguocomment
8、= share directorypath = /home/tguopublic = yeswritable = yescreate mask = 777Linux user = SMB user1 SMB user2root = administrator admin nAccess Samba file (s) in Linux environmentnsmbclient L hostnsmbclient hostshare directoryAccess Each OtherCould we really access the share directory?DO NOT FORGET
9、TO CHANGE PERMISSION !nWindows shares Linux file(s)nNetwork neighbor (网上邻居)nAddress bar IP address or host namenUse “net use * /delete “ to clean connection in buffernLinux accesses windows filesnExports files (开放文件共享功能)nLog in windows system and to view shared resource as a smb client#smbclient L h
10、ostdirectory#smbclient hostdirectory#smbmount /host/directory /mnt/smbn You may has a same user account in Linux and Windows nLogin and logoffnsmbclient host nameshared file# smbclient sicnu1Cnsmb: ? (帮助)nexitQuestions:1. Try to change security level. 2. Test the security within different OSs-Window
11、s XP home edition, professional edition.Laboratory 12 Sharing Resource between Windows System and Linux System(Verified 4 class hours)Laboratory ObjectivesnUnderstand mechanism of SMBnLearn to management of sharing resource with sambanLearn usage of smbclient and know mounting with smbmountTools and
12、 Preparation nRed Hat Linux operating systemDetails for LaboratorynSet up and configure the configuration file for samba, start smb,and check resultnShare resource between windows and LinuxnShare a directory in Windows, then access the shared resource using smbclient and smbmount in LinuxnSet up sam
13、ba in Linux,then access the shared resource through windows. Requirements: nConfigure with share security levelnCreate a directory /test in home root directorynShare /test with read and write requirementnUpload and download a file in Windows nSet up a sharing file for specific usersnuseradd tguonpasswd tguonsmbpasswd a tguo /add samba account to sambanmkdir /var/samba/tguo