“UbuntuHelp:NetwarePrintingFromUbuntu”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/NetwarePrintingFromUbuntu}} | {{From|https://help.ubuntu.com/community/NetwarePrintingFromUbuntu}} | ||
− | {{Languages| | + | {{Languages|UbuntuHelp:NetwarePrintingFromUbuntu}} |
第20行: | 第20行: | ||
Create the script /usr/lib/cups/backend/ncp | Create the script /usr/lib/cups/backend/ncp | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
use strict; | use strict; | ||
− | |||
− | |||
my $NPRINT = "nprint"; | my $NPRINT = "nprint"; | ||
− | |||
my $NCP_HOME = "/root"; | my $NCP_HOME = "/root"; | ||
− | |||
− | |||
if (scalar(@ARGV) == 0) { | if (scalar(@ARGV) == 0) { | ||
print "network ncp \"Unknown\" \"NetWare Printer via NCP\"\n"; | print "network ncp \"Unknown\" \"NetWare Printer via NCP\"\n"; | ||
第61行: | 第36行: | ||
} | } | ||
− | |||
if (scalar(@ARGV) < 5 || scalar(@ARGV) > 6) { | if (scalar(@ARGV) < 5 || scalar(@ARGV) > 6) { | ||
print STDERR "ERROR: ncp job user title copies options [filename]\n"; | print STDERR "ERROR: ncp job user title copies options [filename]\n"; | ||
第70行: | 第44行: | ||
my $printer = $ENV{"DEVICE_URI"}; | my $printer = $ENV{"DEVICE_URI"}; | ||
− | |||
my ($server, $queue, $nwuser, $nwpass); | my ($server, $queue, $nwuser, $nwpass); | ||
− | |||
for ($printer) { | for ($printer) { | ||
第101行: | 第73行: | ||
} | } | ||
− | |||
if (not defined $server or not defined $queue) { | if (not defined $server or not defined $queue) { | ||
print STDERR "ERROR: malformed printer URI\n"; | print STDERR "ERROR: malformed printer URI\n"; | ||
第107行: | 第78行: | ||
} | } | ||
− | |||
$nwuser =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $nwuser; | $nwuser =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $nwuser; | ||
$nwpass =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $nwpass; | $nwpass =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $nwpass; | ||
第113行: | 第83行: | ||
$queue =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $queue; | $queue =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $queue; | ||
− | |||
my @command = ($NPRINT, "-S", $server, "-q", $queue, "-N"); | my @command = ($NPRINT, "-S", $server, "-q", $queue, "-N"); | ||
− | |||
if (defined $nwuser) { | if (defined $nwuser) { | ||
push @command, "-U"; | push @command, "-U"; | ||
第122行: | 第90行: | ||
} | } | ||
− | |||
if (defined $nwpass) { | if (defined $nwpass) { | ||
push @command, "-P"; | push @command, "-P"; | ||
第128行: | 第95行: | ||
} | } | ||
− | |||
if (defined $file) { | if (defined $file) { | ||
if ($file =~ /^-/) { | if ($file =~ /^-/) { | ||
第139行: | 第105行: | ||
} | } | ||
− | |||
$ENV{"HOME"} = $NCP_HOME; | $ENV{"HOME"} = $NCP_HOME; | ||
− | |||
my $result = system { $command[0] } @command; | my $result = system { $command[0] } @command; | ||
− | |||
if ($result != 0) { | if ($result != 0) { | ||
print STDERR "ERROR: nprint exited with status $result\n"; | print STDERR "ERROR: nprint exited with status $result\n"; | ||
第151行: | 第114行: | ||
} | } | ||
− | |||
exit 0; | exit 0; | ||
</nowiki></pre> | </nowiki></pre> | ||
第182行: | 第144行: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
LogLevel warning | LogLevel warning | ||
− | |||
SystemGroup lpadmin | SystemGroup lpadmin | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
ConfigFilePerm 0600 | ConfigFilePerm 0600 | ||
第214行: | 第156行: | ||
Printcap /var/run/cups/printcap | Printcap /var/run/cups/printcap | ||
RunAsUser Yes | RunAsUser Yes | ||
− | |||
− | |||
− | |||
− | |||
Port 631 | Port 631 | ||
− | |||
− | |||
− | |||
− | |||
BrowseOrder allow,deny | BrowseOrder allow,deny | ||
BrowseAllow @LOCAL | BrowseAllow @LOCAL | ||
BrowseAddress @LOCAL | BrowseAddress @LOCAL | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<Location /> | <Location /> | ||
AuthType None | AuthType None | ||
第255行: | 第183行: | ||
</Location> | </Location> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
<Location /admin> | <Location /admin> | ||
AuthType None | AuthType None | ||
第267行: | 第190行: | ||
</Location> | </Location> | ||
− | |||
DefaultAuthType Basic | DefaultAuthType Basic | ||
− | |||
<Location /admin/conf> | <Location /admin/conf> | ||
AuthType Basic | AuthType Basic | ||
第278行: | 第199行: | ||
</Location> | </Location> | ||
− | |||
<Policy default> | <Policy default> | ||
# Job-related operations must be done by the owner or an adminstrator... | # Job-related operations must be done by the owner or an adminstrator... | ||
第304行: | 第224行: | ||
</Policy> | </Policy> | ||
− | |||
Include /etc/cups/cups.d/ports.conf | Include /etc/cups/cups.d/ports.conf | ||
Include /etc/cups/cups.d/browse.conf | Include /etc/cups/cups.d/browse.conf | ||
第312行: | 第231行: | ||
---- | ---- | ||
− | AccessingNetwareShares CategoryNetworking CategoryDocumentation | + | AccessingNetwareShares [[category:CategoryNetworking]] [[category:CategoryDocumentation]] |
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2007年5月14日 (一) 11:26的版本
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
目录
Introduction
This page covers only how to install a Netware Printer Queue in Ubuntu.
What is Needed
perl - Larry Wall's Practical Extraction and Report Language, needed for ncp script.
ipx - utilities to configure the kernel ipx interface.
ncpfs - a set of utilities to use resources from NetWare servers, in particular nprint to print to a netware printer queue.
kdeprint - print system for KDE, this is a very nice tool.
NCP script
Create the script /usr/lib/cups/backend/ncp
use strict; my $NPRINT = "nprint"; my $NCP_HOME = "/root"; if (scalar(@ARGV) == 0) { print "network ncp \"Unknown\" \"NetWare Printer via NCP\"\n"; exit 0; } if (scalar(@ARGV) < 5 || scalar(@ARGV) > 6) { print STDERR "ERROR: ncp job user title copies options [filename]\n"; exit 1; } my ($job, $user, $title, $copies, $options, $file) = @ARGV; my $printer = $ENV{"DEVICE_URI"}; my ($server, $queue, $nwuser, $nwpass); for ($printer) { # ncp://USERNAME:PASSWORD@SERVER/QUEUE m|^ncp://(.+):(.*)@(.+)/(.+)| && do { $nwuser = $1; $nwpass = $2; $server = $3; $queue = $4; last; }; # ncp://USERNAME@SERVER/QUEUE m|^ncp://(.+)@(.+)/(.+)| && do { $nwuser = $1; $server = $2; $queue = $3; last; }; # ncp://SERVER/QUEUE m|^ncp://(.+)/(.+)| && do { $server = $1; $queue = $2; last; }; } if (not defined $server or not defined $queue) { print STDERR "ERROR: malformed printer URI\n"; exit 1; } $nwuser =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $nwuser; $nwpass =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $nwpass; $server =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $server; $queue =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge if defined $queue; my @command = ($NPRINT, "-S", $server, "-q", $queue, "-N"); if (defined $nwuser) { push @command, "-U"; push @command, $nwuser; } if (defined $nwpass) { push @command, "-P"; push @command, $nwpass; } if (defined $file) { if ($file =~ /^-/) { # Avoid file names which look like switches $file = "./$file"; } push @command, $file; } else { push @command, "-"; } $ENV{"HOME"} = $NCP_HOME; my $result = system { $command[0] } @command; if ($result != 0) { print STDERR "ERROR: nprint exited with status $result\n"; exit 1; } exit 0;
Restart CUPS
After changing this file, restart CUPS by running ...
sudo /etc/init.d/cupsys restart
or use the Services tool under Gnome menu System -> Administration.
1. Add a printer definition, using kdeprint (Gnome menu System -> Preferences -> Printers).
Select Other printer type.
In the URl: type
ncp://COMPANY_FS/PRINTER_Q
If at this point you don't see 'Netware Printer via ncp' then refer to 'NCP Script' above.
Select the relevent printer etc. and you should have a working Netware Printer.
Add a Netware Printer with Cups Web Interface
This needs an Administrator account.
Please refer to NetworkPrintingWithUbuntu -> Ubuntu Client Machine for more info.
LogLevel warning SystemGroup lpadmin ConfigFilePerm 0600 LogLevel info Printcap /var/run/cups/printcap RunAsUser Yes Port 631 BrowseOrder allow,deny BrowseAllow @LOCAL BrowseAddress @LOCAL <Location /> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /jobs> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /printers> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /admin> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> DefaultAuthType Basic <Location /admin/conf> AuthType Basic Require user @SYSTEM Order allow,deny Allow localhost </Location> <Policy default> # Job-related operations must be done by the owner or an adminstrator... <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job> Require user @OWNER @SYSTEM Order deny,allow </Limit> # All administration operations require an adminstrator to authenticate... <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default> AuthType Basic Require user @SYSTEM Order deny,allow </Limit> # Only the owner or an administrator can cancel or authenticate a job... <Limit Cancel-Job CUPS-Authenticate-Job> Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit All> Order deny,allow </Limit> </Policy> Include /etc/cups/cups.d/ports.conf Include /etc/cups/cups.d/browse.conf
To access the Cups Web Interface goto http://localhost:631/
AccessingNetwareShares