Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
CUPS/プリンター共有のソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
CUPS/プリンター共有
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:プリンター]] [[en:CUPS/Printer sharing]] [[ru:CUPS/Printer sharing]] [[zh-hans:CUPS/Printer sharing]] {{Related articles start}} {{Related|Samba}} {{Related|CUPS}} {{Related articles end}} この記事では GNU/Linux システム間、あるいは GNU/Linux システムと Microsoft Windows の間でプリンターを共有する方法を説明しています。 ==GNU/Linux システム間== サーバーはウェブインターフェイスを使用するか {{ic|/etc/cups/cupsd.conf}} を手動で編集することで設定できます。クライアントの設定については、[[CUPS#ローカルの CUPS サーバーを使わない]]を見てください。 ===ウェブインターフェイスを使う=== サーバーのウェブインターフェイスを開いて、''Administration'' タブを選択肢、''Server'' の下にある "Share printers connected to this system" オプションを有効にしてください。''Change Settings'' ボタンを押すことで変更が保存され、サーバーは自動的に再起動します。 複雑な設定を行いたい場合、''Edit Configuration File'' を選択することで直接 {{ic|/etc/cups/cupsd.conf}} ファイルを編集できます。詳しくは[[#手動セットアップ]]を見てください。 ===手動セットアップ=== サーバー側のコンピュータ (プリンターに直接接続するコンピュータ) で、location ディレクティブを編集してサーバーへのアクセスを許可してください。例: {{hc|/etc/cups/cupsd.conf| <Location /> Order allow,deny Allow localhost Allow 192.168.0.* </Location> ... }} また、クライアントが使用する IP アドレスでサーバーが待機するようにしてください: {{hc|/etc/cups/cupsd.conf| ... Listen <hostname>:631 ... }} 自動的に設定する方法など、詳しい解説は [http://localhost:631/help/network.html Using Network Printers] を見てください。 編集したら、CUPS を再起動してください。 ソケットアクティベーションを使って CUPS を起動している場合、{{ic|org.cups.cupsd.socket}} の[[systemd#ドロップインファイル|ドロップインファイル]]を作成してリモート接続でもソケットアクティベーションができるようにしてください: {{hc|/etc/systemd/system/org.cups.cupsd.socket.d/override.conf|<nowiki> [Socket] ListenStream=631 </nowiki>}} ===ブラウジングの有効化=== ブラウジング (共有プリンターの探知) を有効にするには、サーバーに [[Avahi]] をインストールして起動する必要があります。プリンターの探知が必要ない場合、サーバーとクライアントには Avahi が必要ありません。 {{Note|cupsd が起動する前に [[Avahi]] が立ち上がっていないとブラウジングは機能しません。}} ブラウジングを有効にするには、ウェブインターフェイスで ''Share printers connected to this system'' を選択するか、手動で Browsing をオンにして BrowseAddress を設定してください: {{hc|/etc/cups/cupsd.conf| ... Browsing On BrowseAddress 192.168.0.*:631 ... }} {{ic|org.cups.cupsd}} サービスを[[再起動]]してください。 印刷サーバーの「ブラウジング」はリモートのネットワークホストのブラウジングとは異なります。印刷サーバでは、{{ic|cupsd}} が {{ic|avahi-daemon}} で通信するための DNS-SD プロトコルのサポートを提供します。古い CUPS プロトコルを使用しなければならない場合や、他のネットワークプリンターも印刷サーバーで「ブラウジング」するのでないかぎり、印刷サーバーに {{ic|cups-browsed}} サービスは不要です。リモートのネットワークホストには、印刷サーバーのネットワーク通信を「ブラウズ」するための {{ic|cups-browsed}} サービスが必須であり、{{ic|cups-browsed}} を実行すると自動的に {{ic|cupsd}} が起動します。 USB プリンターは接続すると {{ic|org.cups.cupsd.service}} サービスが自動的に起動しますが、他の接続タイプでは自動的に起動するとは限りません。{{ic|cupsd}} が起動していないと {{ic|avahi-daemon}} は印刷サービスを提供することができず、その場合、systemd のサービスユニットファイルを起動時に実行するように修正する必要があります。さらに、依存関係が新しくなったらサービスを再度有効化・インストールしなければなりません。サービスファイルの {{ic|[Install]}} セクションを[[編集]]して {{ic|1=WantedBy=default.target}} を追加し、{{ic|org.cups.cupsd.service}} サービスを[[起動]]・[[有効化]]してください。 ==GNU/Linux と Windows== ===Linux サーバー - Windows クライアント=== ====IPP で共有==== Windows クライアントを Linux の印刷サーバーに接続するとき推奨される方法は [[wikipedia:Internet_Printing_Protocol|IPP]] です。HTTP に基づく標準的なプリンタープロトコルであり、ポートフォワーディングやトンネリングなどから様々な恩恵を受けることができます。設定はとても簡単で Samba を使う方法より楽です。IPP は Windows 2000 以降の Windows でネイティブでサポートされています。 {{Note|Internet Printing Client を Windows に追加する必要があるかもしれません (''Control Panel->Programs->Turn Windows features on or off->Print and Document Services'')。}} まず、[[#GNU/Linux システム間]]に書かれているようにサーバーを設定してください。 Windows コンピュータ側で、''コントロールパネル->デバイスとプリンター''から「プリンターの追加」を選択します。Windows 10 の場合は「プリンターが一覧にない場合」をクリックしてください。次に、「共有プリンターの名前で選択する」を選んでプリンターの場所を入力してください: http://''hostname'':631/printers/''printer_name'' ''hostname'' は GNU/Linux サーバーのホスト名や IP アドレスに、''printer_name'' は接続されているプリンターの名前に置き換えてください。サーバーの完全修飾ドメイン名を使うこともできますが、{{ic|/etc/cups/cupsd.conf}} で {{ic|ServerAlias my_fully_qualified_domain_name}} を設定する必要があります。 {{Note| * Windows の 'Add Printer' ダイアログのパスは要注意です。ダイアログボックスが提案している形式は {{ic|<nowiki>http://computername/printers/printername/.printer</nowiki>}} ですが、この形式は使えません。代わりに、上に書かれている形式を使ってください。 * If you are using '''proxy''' - check used proxy '''exclusions''' twice - it may result in failing to add a printer until reboot even if you will disable proxy at all afterwards (actual for Windows 7).}} 設定後、Windows コンピュータにプリンターのネイティブなプリンタードライバーをインストールしてください。CUPS のプリンタードライバーを使用するように CUPS サーバーを設定している場合、Windows クライアントでは汎用の postscript プリンターを選択します (例 'HP Color LaserJet 8500 PS' や 'Xerox DocuTech 135 PS2')。テストページを印刷してみて印刷設定をテストしてください。 ====Samba で共有==== クライアントの Windows のバージョンが Windows 2000 以下の場合、あるいは IPP で問題が発生する場合、Samba を使って共有することもできます。ただし Samba を使用する方法もまた複雑です。認証の問題が原因で、設定の難易度が高く、間違いやすいものとなっています。 Linux サーバーの Samba を設定するために、{{ic|/etc/samba/smb.conf}} ファイルを編集してプリンターへのアクセスを許可してください。{{ic|smb.conf}} ファイルは以下のようになります: {{hc|/etc/samba/smb.conf|2= [global] workgroup=Heroes server string=Arch Linux Print Server security=user [printers] comment=All Printers path=/var/spool/samba browseable=yes # to allow user 'guest account' to print. guest ok=no writable=no printable=yes create mode=0700 write list=@adm root yourusername }} プリンターを共有するには上記だけで十分ですが、個別のプリンターのエントリを追加するほうが好ましいでしょう: {{hc|/etc/samba/smb.conf|2= [ML1250] comment=Samsung ML-1250 Laser Printer printer=ml1250 path=/var/spool/samba printing=cups printable=yes printer admin=@admin root yourusername user client driver=yes # to allow user 'guest account' to print. guest ok=no writable=no write list=@adm root yourusername valid users=@adm root yourusername }} Please note that this assumes configuration was made so that users must have a valid account to access the printer. To have a public printer, set ''guest ok'' to ''yes'', and remove the ''valid users'' line. To add accounts, set up a regular GNU/Linux account and then set up a Samba password on the server. For instance: # useradd yourusername # smbpasswd -a yourusername <!-- After setting up all the needed user accounts, the samba spool directory also needs configuration: {{bc| # mkdir /var/spool/samba # chmod 777 /var/spool/samba }} The next items that need changing are {{ic|/etc/cups/mime.convs}} and {{ic|/etc/cups/mime.types}}: {{ic|mime.convs}}: {{bc| # The following line is found at near the end of the file. Uncomment it. application/octet-stream application/vnd.cups-raw 0 - }} {{ic|mime.types}}: {{bc| # Again near the end of the file. application/octet-stream }} The changes to {{ic|mime.convs}} and {{ic|mime.types}} are needed to make CUPS print Microsoft Office document files. Many users seem to need that. --> 設定後、Samba デーモンを再起動してください。 Obviously, there are a lot of tweaks and customizations that can be done with setting up a Samba print server, so it is advised to look at the Samba and CUPS documentation for more help. The {{ic|smb.conf.example}} file also has some good samples that might warrant imitating. ===Windows サーバー - Linux クライアント=== {{Warning|Any special characters in the printer URIs need to be appropriately quoted, or, if your Windows printer name or user passwords have spaces, CUPS will throw a "lpadmin: Bad device-uri" error. For example: {{ic|smb://BEN-DESKTOP/HP Color LaserJet CP1510 series PCL6}} becomes: {{ic|smb://BEN-DESKTOP/HP%20Color%20LaserJet%20CP1510%20series%20PCL6}}. This result string can be obtained by running the following command: $ python -c 'from urllib.parse import quote; print("smb://" + quote("BEN-DESKTOP/HP Color LaserJet CP1510 series PCL6"))' }} ====LPD で共有==== Windows 7, 8, 10 には LPD サーバーが組み込まれています。それを使うことでクライアントに ''Samba'' をインストールしたりサーバーで様々な設定を行うことなく簡単に共有が可能です。''Control Panel'' を開いて ''Programs'' -> ''Activate Windows functions'' の ''Print services'' から有効にできます。プロパティによってプリンターの ''shared'' を有効にする必要があります。共有名には空白なカンマなどの特殊文字を使用してはいけません。 それから CUPS からプリンターを追加できます。LPD プロトコルを選択してください。プリンターアドレスは以下のようになります: # lpd://windowspc/printersharename プリンターを追加する前に、使用しているプリンターにあわせて適切なプリンタードライバーをインストールする必要があります。Generic PostScript や RAW ドライバーで動作するかもしれません。 ====IPP で共有==== 上記と同じく、プリンターを共有する際は IPP が推奨プロトコルです。ただし、下に書かれている Samba による方法よりも少しばかり難しくなります。Windows に IPP サーバーをセットアップするには労力が必要です。サーバーソフトウェアとしては一般的に Microsoft の Internet Information Services (IIS) が使われます。Windows 10 などクライアント版の Windows には IPP クライアントしか含まれていないため、IPP で共有することはできません。 ====Samba で共有==== A '''much simpler way''' is using Window's native printer sharing via Samba. There is almost no configuration needed, and all of it can be done from the CUPS Backend. As above noted, if there are any problems the reason is mostly related to authentication trouble and Windows access restrictions. On the server side enable sharing for your desired printer and ensure that the user on the client machine has the right to access the printer. The following section describes how to set up the client, assuming that both daemons (cupsd and smbd) are running. =====ウェブインターフェイスを使って設定===== Samba の CUPS バックエンドはデフォルトで有効になっていますが、何らかの理由で有効でない場合は以下のコマンドを実行してから CUPS を再起動してください: # ln -s $(which smbspool) /usr/lib/cups/backend/smb Next, simply log in on the CUPS web interface and choose to add a new printer. As a device choose "Windows Printer via SAMBA". For the device location, enter: smb://username:password@hostname/printer_name Or without a password: smb://username@hostname/printer_name Make sure that the user actually has access to the printer on the Windows computer and select the appropriate drivers. If the computer is located on a domain, make sure the URI includes the domain: smb://username:password@domain/hostname/printer_name =====手動設定===== 手動で設定する場合、CUPS デーモンを停止して以下のように {{ic|/etc/cups/printers.conf}} にプリンターを追加してください: {{hc|/etc/cups/printers.conf|2= <DefaultPrinter MyPrinter> AuthInfoRequired username,password Info My printer via SAMBA Location In my Office MakeModel Samsung ML-1250 - CUPS+Gutenprint v5.2.7 # <= use 'lpinfo -m' to list available models DeviceURI smb://username:password@hostname/printer_name # <= server URI as described in previous section State Idle Type 4 Accepting Yes Shared No JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 AllowUser yourusername # <= do not forget to change this OpPolicy default ErrorPolicy stop-printer </Printer> }} 設定したら CUPS デーモンを再起動してテスト印刷を行ってみてください。 =====Windows 印刷サーバーの URI を確認===== Windows では正確なデバイス URI (デバイスの場所) が明確ではありません。CUPS でデバイスの場所を指定するときに問題が発生する場合、以下のコマンドを実行して特定の windows ユーザーから利用できる共有を確認できます: $ smbtree -U ''windowsusername'' Samba が正しく設定されていれば、上記のコマンドでローカルエリアネットワークサブネットで指定した Windows ユーザーから使える全ての共有が表示されます。以下のように出力されます: {{bc|WORKGROUP \\REGULATOR-PC \\REGULATOR-PC\Z \\REGULATOR-PC\Public \\REGULATOR-PC\print$ Printer Drivers \\REGULATOR-PC\G \\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}} 上記の場合、最後の行がプリンターとわかります。上記の EPSON Stylus プリンターに印刷する場合、CUPS で使用する URI は以下のようになります: smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series ==リモート管理== [[#GNU/Linux システム間]]に書かれているようにサーバーをセットアップしたら、設定によってリモートで管理することができます。管理を許可するホストを {{ic|/etc/cups/cupsd.conf}} の {{ic|<Location /admin>}} ブロックに追加してください。使用する構文は[[#手動セットアップ]]で説明されているものと同じです。3つのレベルで権限を与えることができます: <Location /> #access to the server <Location /admin> #access to the admin pages <Location /admin/conf> #access to configuration files リモートホストに与えたいレベルにあわせて、セクションに {{ic|Allow}} ステートメントを追加してください。{{ic|Allow}} ステートメントは以下の形式で使用することができます: Allow from all Allow from host.domain.com Allow from *.domain.com Allow from ip-address Allow from ip-address/netmask Allow from @LOCAL Deny ステートメントを使うこともできます。例えば、ローカルネットワークインターフェイスの全てのホストに完全な権限を与えてたい場合、{{ic|/etc/cups/cupsd.conf}} を以下のように編集: # Restrict access to the server... # By default only localhost connections are possible <Location /> Order allow,deny '''Allow from @LOCAL''' </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny '''Allow from @LOCAL''' </Location> # Restrict access to configuration files... <Location /admin/conf> AuthType Basic Require user @SYSTEM Order allow,deny '''Allow from @LOCAL''' </Location> 以下の設定を追加することでリモートマシンから CUPS ウェブインターフェイスを使用した場合に起こる {{ic|426 - Upgrade Required}} エラーを止めることができます: DefaultEncryption Never === Kerberos === [[Kerberos]] を使ってリモートの CUPS サーバーにアクセスするユーザーを認証することができます。マシンにキータブが存在することが前提で、"HTTP" のチケットが必要です。{{ic|<nowiki>http://localhost:631</nowiki>}} の代わりに {{ic|<nowiki>https://host.example.co.uk:631</nowiki>}} を使ってください。認証するために暗号化 (https) が必要な上に Kerberos/Negotiate を機能させるために完全なホストネームが必要です。さらにサーバーの {{ic|/etc/cups/cupsd.conf}} を設定して {{ic|DefaultAuthType}} を {{ic|Negotiate}} にする必要があります。 [[Samba]] の winbind NSS サポートを使用する場合、AD グループ名を {{ic|/etc/cups/cups-files.conf}} に追加することができます。以下の例では {{ic|sysadmin}} が AD グループです: SystemGroup sys root sysadmin ==トラブルシューティング== 一般的なトラブルシューティングについては [[CUPS/トラブルシューティング]]を見てください。 ====GTK アプリケーションで印刷できない==== GTK アプリケーションから印刷しようとすると "getting printer information failed" と表示される場合、{{ic|/etc/hosts}} に次の行を追加してください: # serverip some.name.org ServersHostname === Samba でプリンターを追加・編集できない === Samba を使ってプリンターを追加・編集しようとすると、インターフェイスによる CPU の使用率が 100% の状態が30秒も続いた後に以下のメッセージが表示される場合: Unable to get list of printer drivers: Success Gutenprint (https://bugs.archlinux.org/task/43708) の既知のバグが原因です。Gutenprint をアンインストールして foomatic-db だけをインストールしてください。次のコマンドで "Success" メッセージの代わりにドライバーのリストが返ってくるはずです: # lpinfo -m === Windows でパーミッションエラー === ユーザーによっては別の構文を使うことで 'NT_STATUS_ACCESS_DENIED' エラーが解決する場合があります (Windows クライアント): smb://workgroup/username:password@hostname/printer_name ==他のオペレーティングシステム== 他の印刷システムと CUPS を繋げる方法の詳細は CUPS マニュアルにあります。例: http://localhost:631/help/network.html
このページで使用されているテンプレート:
テンプレート:Bc
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:META Related articles start
(
ソースを閲覧
)
テンプレート:Man
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Related
(
ソースを閲覧
)
テンプレート:Related articles end
(
ソースを閲覧
)
テンプレート:Related articles start
(
ソースを閲覧
)
テンプレート:Warning
(
ソースを閲覧
)
CUPS/プリンター共有
に戻る。
検索
検索
CUPS/プリンター共有のソースを表示
話題を追加