The world being what it is, the odds are that even the most fervent Linux partisan will, from time to time, be forced to interact with the various Microsoft products. The commands in this section enable Linux to work directly with Microsoft file systems and networking protocols. In the next section, the term "Windows" is used as a shorthand for the DOS, Windows, and OS/2 operating systems.
The differences between the Linux environment and the Windows environment are as innumerable as the differences between good and evil. For that reason, the introduction to this chapter is likely to be a little top heavy. I want to give you enough information to get the job done, but at the same time this book needs to be light enough for an average human to lift it without mechanical assistance.
Windows Filesystems
Historically, Windows used the File Allocation Table (FAT) filesystem. The FAT system stores information on file size, type (e.g., archive, system, hidden, read-only), and modification time. As the FAT system was designed to be run on a single-user PC, there is no provision for access control. The m* suite of commands (mcopy, mdir ) are designed to access FAT filesystems directly from Linux. More recently, we've seen the introduction of NTFS, the NT filesystem, which provides for access control information.
In the Windows environment, path delimiters are backwards ("\" instead of "/") and drives are specified by letters. By convention A: is the floppy disk drive, and C: is the primary hard disk (which may have further logical subdivisions; e.g., D:, E:, etc.). For example, the file test in the subdirectory examples of the floppy disk drive would be specified as
A:\examples\test
Windows Networking Concepts
Windows networking uses the Server Message Block (SMB) protocol for communicating between networked machines. Broadly speaking, the SMB protocol provides the following functionality:
Opening and closing files
Reading and writing data blocks
Retrieving directory information
Maintaining the list of uniform Naming Convention (UNC) names for shared resources (e.g., printers, files)
Associated operating system overhead
The SMB protocol is roughly analogous to a combination of the UNIX NFS networking protocol and lpd line printer daemon.
In comparison to UNIX, SMB has a lot of commands. This means that SMB is more complicated and more likely to have bugs, but at the same time, quicker in that a single SMB command can suffice for two or three NFS commands. |
The SMB protocol runs on top of the NetBIOS network interface. NetBIOS stands for Network Basic Input Output System. It is a session-level (of the OSI model) network interface typically used on Windows networks. NetBIOS provides the following three basic services:
Name Service | Maintain name database for applications. |
Session | Handle connection/disconnection and communication between two applications. |
Datagram | Transmit datagrams (fundamental packets of data) to network, receive those addressed to you. |
NetBEUI is a nonroutable networking protocol designed for LanManager networks. It is a prominent implementation of NetBIOS.
UNC is the syntax used to specify shared network resources ("shares") on a Windows machine. UNC names are of the following form:
\\server\sharename\subdirectory\subdirectory\ \filename
The server and sharename are mandatory; subdirectory and filename specifications are optional. For example, in the sample network described in the start of this section, my printer share is called
\\Loki\HPLJ6
and this chapter is shared as
\\Loki\e\My Documents\Linux Book\26-dos
Windows networks come in two flavors: workgroups and domains. Workgroups, which may be run without an NT machine, are peer-to-peer networks, usually of Windows 95/98 machines. Although workgroups allow shared access to resources (printers, directories) across a network. Workgroups have very limited security features, it is possible to set a password for a printer or other share.
Domains, which require an NT machine, implement centralized access control and are chock full of user level security mechanisms. The NT-server machine that stores account information for a domain is called the primary domain controller.
NT domains and Internet domains are two totally different concepts. |
The process of viewing the resources available on a Windows network is known as browsing. In order to facilitate browsing, Windows networks require that one of the machines on the network maintains a centralized list of browsable resources. The list is known as the browse list, and the computer that maintains the list is known as the master browser.
The Windows Internet Name Service (WINS) is a client-server mechanism for resolving Internet domain names into IP addresses. The LMHOSTS file is a text file used by Windows systems to associate NETBIOS network names with IP addresses (not unlike the /etc/hosts file on Linux). It is found either in the \WINNT\system32\drivers\etc directory (Windows NT) or the \WINDOWS directory (Windows 95/98).
Samba is a suite of programs that run on Linux (or other UNIX) machines, but use the SMB networking protocol. Linux machines running Samba can act as file and print servers for Windows machines. Samba can be obtained from the following internet site:
http://samba.anu.edu.au/pub/samba
The samba configuration file, smb.conf contains the configuration information for both smb and nmbd.
I almost never recommend commercial software, but if you run a network that incorporates both Linux/UNIX and MS-Windows machines, you really ought to take a look at the Exceed package by Hummingbird Communications, Ltd. Exceed provides an X Windows client that can be run on a Microsoft windows machine. This means that you can remotely execute Linux software and have the output show up on your Windows machine. It's quite handy. |
The commands covered in this section include
mattrib | Set attributes on an MS-DOS file. |
mbadblocks | Test MS-DOS disk for bad blocks. |
mcd | Change directories on DOS filesystem. |
mdel | Delete file from DOS directory. |
mdeltree | Delete directory tree on DOS filesystem. |
mdir | Display DOS directory contents. |
mdu | Display usage of DOS disk. |
mformat | Format DOS disk. |
mlabel | Label DOS disk. |
mmd | Make DOS directory. |
mrd | Remove DOS directory. |
mmove | Move file on DOS filesystem. |
mtype | Display contents of DOS file. |
xcopy | Recursively copy contents of DOS directory. |
nmbd | Provide NetBIOS name-server support. |
smbclient | Access Windows machines on the network. |
smbd | Provide LanManager services to network clients. |
smbmount | Mount LanManager filesystem. |
smbstatus | Status information about SMB connection. |
smbumount | Unmount LanManager filesystem. |
testparm | Test SMB configuration file parameters. |