Send Messages to NetWare Users
NetWare supports a mechanism to send messages to logged-in users. The nsend command implements this feature in Linux. You must be logged in to the server to send messages, so you need to supply the fileserver name and login details on the command line with the destination user and the message to send:
# nsend -S vbrew_f1 -U gary -P j0yj0y supervisor "Join me for a lager before we do the print queues!"
Here a user with login name gary sends a tempting invitation to the person using the supervisor account on the ALES_F1 fileserver. Our default fileserver and login credentials will be used if we don't supply them.
Browsing and Manipulating Bindery Data
Each NetWare fileserver maintains a database of information about its users and configuration. This database is called the bindery . Linux supports a set of tools that allow you to read it, and if you have supervisor permissions on the server, to set and remove it. A summary of these tools is listed in Table 15.3.
Table 15.3: Linux Bindery Manipulation Tools
Command Name |
Command Description |
nwfstime |
Display or set a NetWare server's date and time |
nwuserlist |
List users logged in at a NetWare server |
nwvolinfo |
Display info about NetWare volumes |
nwbocreate |
Create a NetWare bindery object |
nwbols |
List NetWare bindery objects |
nwboprops |
List properties of a NetWare bindery object |
nwborm |
Remove a NetWare bindery object |
nwbpcreate |
Create a NetWare bindery property |
nwbpvalues |
Print a NetWare bindery property's contents |
nwbpadd |
Set the value of a NetWare bindery property |
nwbprm |
Remove a NetWare bindery property |
Printing to a NetWare Print Queue
The ncpfs package contains a small utility called nprint that sends print jobs across an NCP connection to a NetWare print queue. This command creates the connection if it doesn't currently exist and uses the ~/.nwclient file that we described earlier to hide the username and password from prying eyes. The command-line arguments used to manage the login process are the same as those used by the ncpmount, so we won't go through those again here. We will cover the most important command-line options in our examples; refer to the nprint(1) manual page for details.
The only required option for nprint is the name of the file to print. If the filename specified is - or if no filename is specified at all, nprint will accept the print job from stdin. The most important nprint options specify the fileserver and print queue to which you wish the job to be sent. Table 15.4 lists the most important options.
Table 15.4: nprint Command-Line Options
Option |
Description |
- S server_name |
The name of the NetWare fileserver supporting the print queue to which you wish to print. Usually it is convenient for the server to have an entry in ~/.nwclient . This option is mandatory. |
- q queue_name |
The print queue to which to send the print job. This option is mandatory. |
- d job_description |
Text that will appear in the print console utility when displaying the list of queued jobs. |
- l lines |
The number of lines per printed page. This defaults to 66. |
- r columns |
The number of columns per printed page. This defaults to 80. |
- c copies |
The number of copies of the job that will be printed. The default is 1. |
A simple example using nprint would look like:
$ nprint -S REDS01 -q PSLASER -c 2 /home/matt/ethylene.ps
This command would print two copies of the file /home/matt/ethylene.ps to the printer named PSLASER on the REDS01 fileserver using a username and password obtained from the ~/.nwclient file.
Using nprint with the Line Printer Daemon
You will recall we previously mentioned that the -c option for the ncpmount is useful for printing. At last we'll explain why and how.
Linux usually uses BSD-style line printer software. The line printer daemon (lpd) is a daemon that checks a local spool directory for queued jobs that are to be printed. lpd reads the printer name and some other parameters from the specially formatted spool file and writes the data to the printer, optionally passing the data through a filter to transform or manipulate it in some way.
The lpd daemon uses a simple database called /etc/printcap to store printer configuration information, including what filters are to be run. lpd usually runs with the permissions of a special system user called lp .
You could configure nprint as a filter for the lpd to use, which allows users of your Linux machine to output directly to remote printers hosted by a NetWare fileserver. To do this, the lp user must be able to write NCP requests to the NCP connection to the server.
An easy way to achieve this without requiring the lp user to establish its own connection and login is to specify lp as the owner of a connection established by another user. A complete example of how to set up the Linux printing system to handle print jobs from clients over NetWare is listed in three steps:
1. Write a wrapper script.
The /etc/printcap file doesn't permit options to be supplied to filters. Therefore, you need to write a short script that invokes the command you want along with its options. The wrapper script could be as simple as:
#!/bin/sh # p2pslaser - simple script to redirect stdin to the
# PSLASER queue on the REDS01 server
#
/usr/bin/nprint -S REDS01 -U stuart -q PSLASER
#
Store the script in the file /usr/local/bin/p2pslaser .
2. Write the /etc/printcap entry.
We'll need to configure the p2pslaser script we created as the output filter in the /etc/printcap . This would look something like:
pslaser|Postscript Laser Printer hosted by NetWare server:\
:lp=/dev/null:\
:sd=/var/spool/lpd/pslaser:\
:if=/usr/local/bin/p2pslaser:\
:af=/var/log/lp-acct:\
:lf=/var/log/lp-errs:\
:pl#66:\
:pw#80:\
:pc#150:\
:mx#0:\
:sh:
3. Add the -c option to the ncpmount.
ncpmount -S REDS01… -c lp…
Our local user stuart must specify the lp user as the owner of the connection when he mounts the remote NetWare server.
Now any Linux user may choose to specify pslaser as the printer name when invoking lp. The print job will be sent to the specified NetWare server and spooled for printing.
The pqlist command lists all of the print queues available to you on the specified server. If you do not specify a fileserver on the command line using the -S option, or a login name and password, these will be taken from the default entry in your ~/.nwclient file:
# pqlist -S vbrew_f1 -U guest -n
Server: ALES_F1
Print queue name Queue ID
------------------------------------------------------------
Читать дальше