Chapter

74
1 Chapter Linux/Windows Internetworking

description

Chapter. Linux/Windows Internetworking. Chapter Objectives. Samba Practical Customization of Samba on a Linux Server Setting Up SWAT to Remotely Configure Samba on a Windows Client. Origin of Samba. Samba was originally developed in Australia. The Purpose of Samba. - PowerPoint PPT Presentation

Transcript of Chapter

Page 1: Chapter

1

Chapter

Linux/Windows Internetworking

Page 2: Chapter

2

Chapter Objectives

• Samba• Practical Customization of Samba

on a Linux Server• Setting Up SWAT to Remotely

Configure Samba on a Windows Client

Page 3: Chapter

3

Origin of Samba

• Samba was originally developed in Australia

Page 4: Chapter

4

The Purpose of Samba

• Enable interoperability between Windows and Clients

• Example:– Enables a Unix/Linux file server to be

treated like a Windows NT file server by Windows clients

– Enables an NT file server to be treated like a Unix file server by Unix/Linux clients ???

Page 5: Chapter

5

Some More Uses for Samba

• A NetBIOS nameserver (1001/1002) • A FTP style SMB client to access PC shared

items (disks and printers) for Unix, Netware or other operating systems.

• A tar extension for the clients, in order to create remote backups.

• A command line, limited administration tool, that supports some features of Windows NT that may be used over Samba, Windows NT Workstation or Server.

Page 6: Chapter

6

Yet, More Uses for Samba

• Implementation of a password synchronization gateway, or printing gateway, between Unix and Windows NT.

• Give access to Windows NT files from Unix.

• Source:– http://www.linux-mandrake.com/guides71/

en/mdkrefguide/samba-capability.html

Page 7: Chapter

7

• Linux• Solaris• IRIX

– The main o/s for Silicon Graphics workstations and servers. It incorporates Unix System V functionality.

• HPUX• Almost all other versions of Unix

Operating Systems for Samba

Page 8: Chapter

8

Companies Using Samba

• Cisco• Bank of America• Hewlett Packard• Johnson and Johnson• British Petroleum• Solomon Smith Barney (Citibank’s

Investment Brokerage Division)

Source: http://www.valinux.com/software/samba.html

Page 9: Chapter

9

Samba and Windows

• Windows NT OS uses a layered architecture with partitioned user and kernel modes similar to those of UNIX.

• NETBIOS – over – TCP/IP (NetBT) is used by Samba to share UNIX resources with Windows clients

• SMB AND CIFS are NetBT based protocols for communication between clients and servers

Page 10: Chapter

10

SMB PROTOCOL

• Created in 1987 as a joint venture between Microsoft and Intel

• SMB is an acronym for Server Message Block

• Excellent source on SMB– http://samba.anu.edu.au/cifs/docs/

what-is-smb.html

Page 11: Chapter

11

Purpose of SMB

• SMB, which stands for Server Message Block, is a protocol for sharing files, printers, serial ports, and communications abstractions such as named pipes and mail slots between computers

http://samba.anu.edu.au/cifs/docs/what-is-smb.html

Page 12: Chapter

12

SMB Operation

http://samba.anu.edu.au/cifs/docs/what-is-smb.html

Page 13: Chapter

13

SMB’s Place in the ISO-OSI Model

http://samba.anu.edu.au/cifs/docs/what-is-smb.html

Page 14: Chapter

14

SMB Functions

• 1) Session commands: used to set up a virtual circuit and validate access.

• 2) File commands: permits an application to operate on files.

• 3) Printer commands: permits an application to spool jobs to remote printers.

• 4) Message commands: provide a means for passing alert, control, and informational messages between the consumer and server applications

Page 15: Chapter

15

CIFSCommon Internet File

System

• In 1997 Microsoft submitted CIFS specification to IETF

• It is a derivation of SMB offered as a public domain specification

Page 16: Chapter

16

Kerberos Ticket Exchange

Source: Samba Unix & NT Internetworking

Page 17: Chapter

17

End of Module

Page 18: Chapter

18

Module

Samba Installation and Usage

Page 19: Chapter

19

Obtaining Samba

• Samba can be downloaded from www.samba.org

• Samba is often supplied as part of the Linux package by vendors

Page 20: Chapter

20

Installing Samba

• Samba is installed as one of the packages when installing Linux

• Any RPM installation facility can be used for the installation of Samba

• An example would be to use KDE’s package installation feature to install Samba

Page 21: Chapter

21

Samba Installation and Configuration Example

• Source– http://www.linux-mandrake.com/

guides71/en/mdkrefguide/samba.html

Page 22: Chapter

22

Samba Installation and Configuration Overview

Install Sambafrom CD-ROM

Configure SambaServer (samba.conf)

Test configuration andlaunch Samba

Install Samba toolsas necessary

Install SWAT GUI toolif desired

Page 23: Chapter

23

Installing Samba

• If you already use Samba, run /etc/rc.d/init.d/smb stop. Otherwise, on the installation CDROM you will find the package named samba which you can install, as root, with command rpm -Uvh samba-*.

Page 24: Chapter

24

Smb.conf File

• During installation a /etc/smb.conf file is copies to the computer

• Entries in this file must be changed to configure Samba

Page 25: Chapter

25

Key Areas of Configuration

• Global• Printers • Homes

Page 26: Chapter

26

Sample samba.conf

• View– http://www.linux-mandrake.com/

guides71/en/mdkrefguide/samba-conf.html

Page 27: Chapter

27

Global[global] netbios name = Zeus netbios aliases = creation

# without these two entries, the first part of the # DNS name will be used instead.

workgroup = DESIGN # Samba can only belong to one work group

at a time

server string = File server [%v] # this indicates the name and the version

number to print

Page 28: Chapter

28

Global Cont.

deadtime = 15 # maximal inactivity time

auto services = john # this service, although present in the

exploration list, is not available until john connects to the server

security = user

Page 29: Chapter

29

Security Modes

• Share mode• User mode• Server mode• Domain mode

Page 30: Chapter

30

Share Mode

1. {share mode}: In this mode, the client sends a password while asking for a connection, but no username is required. This mode is the default security mode for files or printers under Windows 95. It may be changed, under Windows 95 in the Network section of the Configuration Panel, under Access Control.

Page 31: Chapter

31

User Mode

2. {user mode}: This security mode is recommended. You are asked for a valid username and its associated password.

Page 32: Chapter

32

Server and Domain Mode

3. {server mode}: This mode is derived from user mode. The Samba server sends a session opening request to the passwords server.

password server = NT_passerv #where NT_passerv is the name of the NT

passwords server. Various servers may be listed.

4. {domain mode}: Nearly the same as server mode

Page 33: Chapter

33

Adding Hosts to Access the Linux server

hosts allow = john.design.org 192.168.2.#Allows all users from john.design.org

and all hosts with the beginning TCP/IP address 192.168.2.

Deny 192.168.2.5#Deny access from host 192.168.2.5

Page 34: Chapter

34

Creating a Guest Account

guest account = pcguest # If you wish to add a guest user; to be

# added in /etc/passwd

Page 35: Chapter

35

Setting Up a Share

• First of all, create the shared directory with the command mkdir /home/shared and set owners and permissions with chmod and chown.– For example, chmod 0777 gives all

rights towards this folder on the Unix side. However, Samba has to allow this too.

Page 36: Chapter

36

Commands to Create a Share[share]

comment = share access granted to everyone path = /home/shared browsable = yes writable = yes create mask = 0750 # means that the creator of the file has rwx # rights on it, the group r-x and others r–

directory mask = 0750# same meaning but for directories

mangled names = yes # converts names in a DOS/Windows manner, with # eight characters for the name and three for the # extension.

preserve case = no # do not take case into account.

Page 37: Chapter

37

Another Share Example

[zip] comment = automatically mount/unmount the zip drive

browseable = yes path = /mnt/zip root preexec = /bin/mount /dev/sda4 /mnt/zip root postexec = /bin/unmount /mnt/zip

First of all, be sure to load the ppa module with command modprobe ppa.o.

Page 38: Chapter

38

Creating Home Directory for Users

[homes] comment = Home directories browseable = no writable = yes path = /export/homes/%U valid users = %S

Page 39: Chapter

39

Setting Up a Printer for Sharing

[printers] comment = shared printers path = /var/spool/samba load printers = yes # load all available printers browseable = no printable = yespublic = no writable = no create mode = 0700

Page 40: Chapter

40

Sample samba.conf File[global]

workgroup = MyWorkGroup server string = (Samba %v) #server string = Samba Server browseable = yes printing = bsd printcap name = /etc/printcap load printers = yes log file = /var/log/samba/log.%m max log size = 100 lock directory = /var/lock/samba locking = no strict locking = no share modes = yes

Page 41: Chapter

41

Sample samba.conf File Cont.

security = user null passwords = yes socket options = TCP_NODELAY

# Allows the Samba server to become a domain controller

#os level = 33 #domain master = yes # Facilitates the long names recognition

preserve case = no short preserve case = no character set = iso8859-1

Page 42: Chapter

42

Sample samba.conf File Cont.

[homes] comment = Home Directories preexec = /bin/sh -c 'echo /usr/bin/smbclient -

M %m -I %I'& browseable = yes readonfiltered= no writable = yes create mode = 0750public = yes

Page 43: Chapter

43

Sample samba.conf File Cont.

["public"]comment = "Public"

path = /public/ browseable = yeshide dot files = yes readonfiltered= no public = yes pritable = yes #create mode = 0775 printable = no

Page 44: Chapter

44

Sample samba.conf File Cont.

["printers"] comment = All Printers #path = /var/spool/samba path =

/var/spool/lpd/lpbrowseable = yes # Set public = yes to allow user 'guest

account' to printguest ok = yes writable = yes printable = yes

Page 45: Chapter

45

[tmp]comment = Temporary file spacepath = /tmpread only = nopublic = yes

Set Temporary File Space

Page 46: Chapter

46

Check for Changes Made

• Now save changes to smb.conf• Before launching smb and nmb

daemons, launch testparm. This command will read /etc/smb.conf and print which entries will be taken into account

Page 47: Chapter

47

Reload Samba

• No need to reboot the computer• Reload Samba using Unix

command to activate the new configuration– samba stop– samba start

Page 48: Chapter

48

Using the Command Mode to Reload Samba

• Then just type /etc/rc.d/init.d/smb start. The following messages should be printed: Starting SMB services: [OK] Starting NMB services: [OK] To check that the daemon is running, run ps aux | grep smbd or /etc/rc.d/init.d/smb status

Page 49: Chapter

49

End of Samba Configuration

• The Samba server is now ready for use

Page 50: Chapter

50

Accessing Linux File Server from a PC Client

• Login on a PC Client using a guest ID and password preset at Linux server

• Open Network Neighborhood• The Linux server should show up as

it were in a NT network• Shared Resources Shown

– Printer(s)– Public folder – [tmp]– Private folders [homes] [client-name]

Page 51: Chapter

51

Setting Up PC Clients on Linux Sever

• Open User Manager – System User Manger (at KDE)

• Add PC User(s)– Add names (first character must be upper

case to make it work, Linux is case sensitive)– Setup password– Primary Group: Guest

• Add New User(s) to Guest Group– Open Guest Group Properties– Add new user(s) to the guest group

• Save All Changes

Page 52: Chapter

52

smbclient Tool

• This is a utility close to ftp that enables you to connect to a PC running Windows.

• To know the list of shares accessible on PC win through SMB, launch smbclient -L win -N.

• Launch smbclient //win/work to connect to the share work on the PC called win. You may also use smbclient \\\\win\\work.

• To create a tar archive of the work share, launch smbclient //win/work -Tc work.tar.

Page 53: Chapter

53

Printing

• To print a file letter.txt to the printer my_printer connected to the PC win, type cat letter.txt | smbclient //win/printer_name my_password \ -N -c "put - john“

• For more information, run man smbclient

Page 54: Chapter

54

smbfs Tool

• For you to be able to mount/unmount some directories from Windows on your Linux box, your kernel needs to support the smbfs filesystem (which is the case for the Linux-Mandrake distribution). Then you can use the programs smbmount and/or smbumount. For example: smbmount "\\win\work" -c 'mount /mnt -u 123 -g 456'. Which will locally mount the share work with a local UID of 123 and a local GID of 456.

Page 55: Chapter

55

smbtar Tool

• Allows to create tar archives remotely. Read the manual page for more information on its numerous options.

Page 56: Chapter

56

GUI Tool: SWAT

• SWAT is a configuration GUI included with the Samba package

• SWAT – Samba Web Administration Tool

Page 57: Chapter

57

Setting Up SWAT at Linux File Server

• Open /etc/inetd.conf• Add or uncomment this line:

– Swat stream tcp nowait.400 root /usr/local/samba/sbin/swat swat

Page 58: Chapter

58

Configure Samba Using SWAT at a PC Client

• Logon to a PC Client • Open a web browser• Enter URL: http://localhost:901

(replace “localhost” with actual host name)

• Login as root on the popup Window• Make any changes or check status

of Samba using SWAT’s graphical interface

Page 59: Chapter

59

Logon Screen

Page 60: Chapter

60

SWAT Interfac

e

Page 61: Chapter

61

Module

Summary of Samba Tools and Resources

Page 62: Chapter

62

Whats are the Components of Samba?

• Smbd• smbclient• smbstatus• make_smbcodepage

• nmbd• testparm• testprns• nmblookup• smbpasswd

The Samba suite is made up of several components.

Page 63: Chapter

63

smbd

• smbd is the server daemon that provides filesharing and printing services to Windows clients. The server provides filespace and printer services to clients using the SMB (or CIFS) protocol. This is compatible with the LanManager protocol, and can service LanManager clients. These include MSCLIENT 3.0 for DOS, Windows for Workgroups, Windows 95, Windows NT, OS/2, DAVE for Macintosh, and smbfs for Linux.

Page 64: Chapter

64

nmbd

• nmbd is a server that understands and can reply to NetBIOS over IP name service requests, like those produced by SMBD/CIFS clients such as Windows 95/98, Windows NT and LanManager clients. It also participates in the browsing protocols which make up the Windows “Network Neighborhood” view.

Page 65: Chapter

65

nmbd

• nmbd can also be used as a WINS (Windows Internet Name Server) server. What this basically means is that it will act as a WINS database server, creating a database from name registration requests that it receives and replying to queries from clients for these names. In addition, nmbd can act as a WINS proxy, relaying broadcast queries from clients that do not understand how to talk the WINS protocol to a WIN server.

Page 66: Chapter

66

smbclient

• smbclient is a client that can ‘talk’ to an SMB/CIFS server. It offers an interface similar to that of the ftp program (see ftp (1)). Operations include things like getting files from the server to the local machine, putting files from the local machine to the server, retrieving directory information from the server and so on.

Page 67: Chapter

67

testparm

• testparm is a very simple test program to check an smbd configuration file for internal correctness. If this program reports no problems, you can use the configuration file with confidence that smbd will successfully load the configuration file. If testparm finds an error in the smb.conf file it returns an exit code of 1 to the calling program, else it returns an exit code of 0. This allows shell scripts to test the output from testparm

Page 68: Chapter

68

testprns

• testprns is a very simple test program to determine whether a given printer name is valid for use in a service to be provided by smbd

Page 69: Chapter

69

smbstatus

• smbstatus is a very simple program to list the current Samba connections

Page 70: Chapter

70

nmblookup

• nmblookup is used to query NetBIOS names and map them to IP addresses in a network using NetBIOS over TCP/IP queries. The options allow the name queries to be directed at a particular IP broadcast area or to a particular machine. All queries are done over UDP

Page 71: Chapter

71

make_smbcodepage

• make_smbcodepage compiles or de-compiles codepage files for use with the internationalization features of Samba 2.0

Page 72: Chapter

72

smbpasswd

• The smbpasswd utility allows you to change SMB encrypted passwords on Samba and Windows NT™ servers.

Page 73: Chapter

73

Resouces• Derosest, James W. “Samba - Unix & NT Internetworking”.

McGraw-Hill Companies, 2000.• Carter, Gernald & Sharpe, Richard. “Teach Yourself Samba in

24 Hours.” Sams, 1999.• Hertel, Christopher and Leighton, Luke. “The Story of Samba: Linux's

Stealth Weapon.” <http://www.linux-mag.com/1999-09/samba_01.html>• http://www.linux.org/ • http://www.samba.org • http://linuxtoday.com/ • http://www.andover.net/ • http://www.linux-2000.org • http://www.nwc.com/1104/1104f3.html • http://faq.oreillynet.com/linux/FAQ_7_40.shtm• http://www.linux.org/info/advocacy.html• http://www.geocities.com/SiliconValley/Haven/6087/• ttp://www.linuxlinks.com/local/why.shtml

Page 74: Chapter

74

End of Chapter