Accessing Windows from a Unix Perspective


With the adoption of Samba and the availability of mature file sharing utilities such as FTP and NFS, the lines have blurred where files are located on a computer network. Windows Server 2003 also exposes many command line tools for management that can be accessed via telnet from Unix-based clients .

Windows Server 2003 Must Be Run in Mixed Mode

For interoperation with utilities such as Samba, Windows Server 2003 must be run in Mixed mode. With the updated version of Samba (3.0.0 RC2 as of this writing), Windows Server 2003 can be run in Windows 2000 mode.


Accessing Windows with Telnet

Unix system administration is predominantly command-line driven, with Telnet being one of the main tools of choice for this purpose. Windows Server 2003 has come a long way in providing command-line utilities, all of which are available through the Telnet server both natively and with Windows SFU.

An administrator telnetting to a Windows Server 2003 session can, for example, run command line scripting utilities such as adsutil .vbs, as shown in Figure 16.16.

Figure 16.16. adsutil.vbs command line usage via Telnet.

graphics/16fig16.gif

Telnet Server on Windows 2003

The Telnet Server on Windows 2003 is disabled by default. You need to set the startup to Automatic and start the service.


Accessing Windows File Services

On a Unix-based system Samba uses the smbclient to access Windows-based shares. This is a command-line interface-based tool that has many functions besides just connecting to Windows shares. It can also be used for testing configurations, debugging, and automating administrative tasks when used in shell scripts.

There are many combinations of variables and command line options with the smbclient. The following are a few examples:

To list the resources in the domain (rtds is the domain controller and master browser):

 
 $ smblicent -L rtds 

To list the services on a single computer (rtws01), run this command:

 
 $ smbclient -L rtws01 

To connect to a share using username/password authentication:

 
 $ smbclient //rtws01/shared -U username%password 

These are just a few examples of the smbclient command. The Samba documentation concerning smbclient contains a complete reference.

Accessing Windows Print Services

Samba allows the Unix/Linux user to print to a printer shared on a Windows system. This makes it convenient for you because you only have to set file and print sharing for Unix.

Many Unix variants, including Linux, use what is called the BSD printing system. With this system all the printers that will be used have an entry in the /etc/printcap file. This file describes printer capabilities used by the line printer daemon (lpd) and other programs that assist with printing.

Listing 16.1 shows a sample printcap.local file that shows a Hewlett-Packard LaserJet 4050 being shared on a Windows Server 2003 system named rtfnp.

Listing 16.1 /etc/printcap.local
 lprtfnp-hplj4050:\ :cm=HP 4050 on rtfnp:\ :sd=/var/spool/lpd/rtfnp:\ :af=/var/spool/lpd/rtfnp/acct:\ :if=/user/local/samba/bin/smbprint:\ :mx=0:\ lp:=/dev/null: 

The Red Hat Linux /etc/printcap File

In Red Hat Linux the /etc/printcap file is generated automatically and should not be edited. Any manual entries should be placed in the /etc/printcap.local file which is read by the /etc/printcap file.


This entry describes the server and printer as follows :

  • In line 1, lp designates this as the default printer, rtfnp-hplj4050 describes the name of the print server and the type of printer.

  • In line 2, the cm keyword allows for a description of the printer share.

  • In line 3, the sd keyword assigns the printer's spool directory.

  • In line 4, the af keyword assigns the printer's accounting files.

  • In line 5, the if keyword assigns the print filter (in this case the smbprint command to the shared printer).

  • In line 6, the mx keyword sets the maximum file size to be printed. In this case it is set to zero, which allows any size file.

  • In line 7, the lp keyword is set to /dev/null to discard error messages.

This example can be used to create as many printers as desired on the client's Unix-based system.

To set up Samba printing on the Unix client, perform the following steps:

  1. Install the smbprint program (from the Samba source root directory):

       
      # cp examples/printing/smbprint /user/local/samba/bin  
  2. Create the printer's spool directory.

       
      # cd /var/spool/lpd # mkdir rtfnp # chown lp:lp rtfnp # chmod 700 rtfnp  
  3. Create the .config file.

       
      # cd rtfnp # >.config # chown lp:lp .config # chmod 600 .config  
  4. Insert the following information about the printer and how to connect with a text editor into the .config file:

       
      server=rtfnp service=hplj4050 password="<domain password>"  
  5. Restart the printer daemon:

       
      # /etc/rc.d/init.d/lpd restart  

Following this procedure you have created a default printer on the local system that will print to the hp 4050 share on the Windows Server 2003 system named rtfnp. To print a test page (/etc/ hosts file) to the default printer you can use the following command:

 
 # lpr /etc/hosts 

Using LPD/LPR

To print to a Windows-based printer from Unix using the LPR command, you must first set up Print Services for Unix on the Windows Server 2003 machine. This is accomplished by performing the following steps:

  1. Select Start, Control Panel, Add or Remove Programs and then select Add/Remove Windows Components.

  2. Select Other File and Print Services and then click on the Details button.

  3. Choose the Print Services for Unix check box and then click on OK.

  4. Select Next and then after the installation is complete choose Finish.

This procedure sets up what looks like a Unix server running the LPD service. The Unix system prints to this resource using the BSD printing system.



Microsoft Windows Server 2003 Insider Solutions
Microsoft Windows Server 2003 Insider Solutions
ISBN: 0672326094
EAN: 2147483647
Year: 2003
Pages: 325

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net