Linux shared printer from windows

CUPS/Printer sharing

This article contains instruction on sharing printers from a GNU/Linux system.

Client support

Protocol Linux Windows macOS
Discovery (DNS-SD/mDNS) CUPS with Avahi Native support since Windows 10 Bonjour
Internet Printing Protocol CUPS Control Panel > Programs > Turn Windows features on or off > Print and Document Services > Internet Printing Client Native support
SMB shared printer Samba with CUPS Native support Native support
Line Printer Daemon protocol CUPS Control Panel > Programs > Turn Windows features on or off > Print services >
LPD Print Service and LPR Port Monitor
Native support

Contents

Creating class for multiple printers

In CUPS, a class is a group of printers which appears to clients as a single printer. When a client selects to print to the class, CUPS selects any printer in the group to accept the print job. This may be especially useful when one printer from the class must be removed. If it is excluded from the class, end users will not notice any change because the print job will be queued to another printer in the class. Creating and managing classes can be done from CUPS Web GUI.

Printer sharing

This article or section needs expansion.

DNS-SD advertisement

To announce the printer to the network over DNS-SD/mDNS (Bonjour in Apple world), Avahi must be installed and running on the server.

To enable it, either select Share printers connected to this system in the web interface, or manually set Browsing On in /etc/cups/cupsd.conf :

Note that «browsing» at the print server is a different thing from «browsing» at a remote networked host. On the print server, cupsd provides the DNS-SD protocol support which the avahi-daemon broadcasts. The cups-browsed service is unnecessary on the print server, unless also broadcasting the old CUPS protocol, or the print server is also «browsing» for other networked printers. On the remote networked host, the cups-browsed service is required to «browse» for network broadcasts of print services, and running cups-browsed will also automatically start cupsd .

The cups.service service will be automatically started when a USB printer is plugged in, however this may not be the case for other connection types. If cups.service is not running, avahi-daemon does not broadcast the print services, so in that case the systemd unit service file must be modified to start on boot, and then the service must again be «enabled/installed» with the new dependency. To do this, edit the service file [Install] section to add a WantedBy=default.target dependency, and then enable and start the cups.service service.

Sharing via Internet Printing Protocol

The server can be configured using either the web interface or by manually editing /etc/cups/cupsd.conf .

Open up the web interface to the server, select the Administration tab, look under the Server heading, and enable the «Share printers connected to this system» option. Save your change by clicking on the Change Settings button. The server will automatically restart.

Читайте также:  Linux lines to string

On the server computer (the one directly connected to the printer), allow access to the server by modifying the location directive. For instance:

Also make sure the server is listening on the IP address the client will use:

There are more configuration possibilities, including automatic methods, which are described in detail in Using Network Printers and cupsd.conf(5) .

After making any modifications, restart cups.service .

If CUPS is started using socket activation, create a drop-in snippet for cups.socket so that socket activation also works for remote connections:

Sharing via Samba

Samba is an implementation of the Windows file and printer sharing protocols, even the most vintage ones.

To configure Samba on the Linux server, edit /etc/samba/smb.conf file to allow access to printers. File smb.conf can look something like this:

That should be enough to share the printer, yet adding an individual printer entry may be desirable:

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. See Samba#User management.

After this, restart smb.service and nmb.service .

See Samba’s documentation Setting up Samba as a Print Server for more details.

Sharing via Line Printer Daemon protocol

Remote administration

Once the server is set up as described in #Printer sharing, it can also be configured so that it can be remotely administered. Add the allowed hosts to the block in /etc/cups/cupsd.conf , using the same syntax as described in #Sharing via Internet Printing Protocol. Note that three levels of access can be granted:

To give remote hosts access to one of these levels, add an Allow statement to that level’s section. An Allow statement can take one or more of the forms listed below:

Deny statements can also be used. For example, to give full access to all hosts on your local network interfaces, edit /etc/cups/cupsd.conf to include this:

You might also need to disable the HTTPS requirement, when using the default self-signed certificate generated by CUPS:

This should avoid the error: 426 — Upgrade Required when using the CUPS web interface from a remote machine.

Kerberos

Kerberos can be used to authenticate users accessing a remote CUPS server. This assumes that your machine has a keytab and it will need a ticket for «HTTP». Instead of using http://localhost:631 you must use https://host.example.co.uk:631 — encryption is required for auth (hence https) and the full hostname is needed so that Kerberos/Negotiate can work. In addition, the server must be configured in /etc/cups/cupsd.conf to use a DefaultAuthType of Negotiate .

If you are using Samba’s winbind NSS support, you can add an AD group name to /etc/cups/cups-files.conf — in the following example sysadmin might be an AD group:

Troubleshooting

See CUPS/Troubleshooting for general troubleshooting tips.

Cannot print with GTK applications

If you get a getting printer information failed message when you try to print from GTK applications, add this line to your /etc/hosts :

Permission errors on Windows

Some users fixed NT_STATUS_ACCESS_DENIED (Windows clients) errors by using a slightly different syntax:

Как расшарить принтер в ubuntu?

Как расшарить принтер в Linux?

Кстати, расшаривал принтер через микро-компьютер OrangePi
– anonymous 4 года назад
Спасибо! Помогло!
– anonymous 4 года назад

7 ответов

Чтобы расшарить принтер на linux, идём на следующий адрес с помощью любого браузера (порт 631):

Шаг1. Открыть общий доступ к принтеру в Ubuntu Linux (через IPP)

Дело в том, что в Linux печатью управляет служба CUPS. В Ubuntu, доступ к настройкам службы CUPS возможен через любой браузер на localhost по порту 631 — т.е. нужно открыть адрес «http://localhost:631«

Читайте также:  Обновить linux после установки

Идём на адрес http://localhost:631/, открываем вкладку Администрирование, установить чекбокс Разрешить совместный доступ к принтерам, подключенным к этой системе

Компьютер с непосредственно подключенным (и уже расшаренным) принтером назовём «сервер«. Понадобится IP сервера, который можно узнать командой ifconfig

После установки чекбокса «Разрешить совместный доступ к принтерам, подключенным к этой системе» нужно подключить локальный принтер для всех «клиентов» — тех компьютеров, которые будут пользоваться принтером по сети.

Шаг 2. Подключение share-принтера на Linux-клиенте.

Если общий принтер на linux, то для подключения принтера на клиенте Linux скорее всего будет достаточно в настройках апплета «Печать» выбрать одно из: новый принтер, найти сетевой принтер, сетевой адрес и т.д., ввести ip сервера и нажать поиск. Принтер будет найден и подключен автоматически. Если вдруг по ip не удалось найти принтер, то проделать шаг 3 как для Windows-клиента.

Шаг 3. Подключение share-принтера на Windows-клиенте.

Для Linux тоже работает. Открываем в браузере настройки службы CUPS, указав ip сервера, например:

http://192.168.0.106:631/printers,

где 192.168.0.106 — ip-адрес нашей Linux машины c принтером.

Если компьютер виден в сети, то откроется страница со списком принтеров:

How to Access A Windows Shared Printer from Ubuntu

Anyone who utilizes multiple computers in a network with a single printer knows the importance of being able to share resources. In a previous tutorial, we explained How to Access Windows 7 Shared Folders from Ubuntu. However, the sharing doesn’t stop there. This tutorial will show how to access from Ubuntu printers that are shared from another Windows computer.

NOTE: Article updated to work on Ubuntu v10.10 & 11.04.

Step 1: Configure the Computers on the Same Workgroup

In order for Ubuntu and Windows 7 to share printers, they have to be configured to be in the same Workgroup.

To change your Windows 7 workgroup, see: How to Change the Workgroup in Windows 7.

Once the Workgroup is set up to be the same on both computers, proceed to step 2 to share your printer.

Step 2: Share the Printer from Windows 7

Next, you’ll need to configure the printer to be shared on the network. To do this, please see: How to Share a Printer on Your Network.

Step 3: Configure Ubuntu to Access the Printer

From your main panel, go to ‘System -> Administration -> Printing’ to open the printer configuration manager.

In this window you can see all the printers installed your computer and the other computers on your network.

Right-click on the network printer that you want to access and from the menu select Properties.

In the Printer Properties window, if the Make and Model of the printer is listed as Local Raw Printer, you need to install drivers for that printer. Click on the corresponding Change button to access the Change Driver window.

Note: If the Make and Model of the printer is correct, you can skip the next steps, because the printer will work from Ubuntu.

In the Change Driver window search the manufacturer of the printer you want to access and select it. In our example, it is HP. Then click on Forward.

Now search and select the correct model of the printer. Ours is a Photosmart C5200. If you have to choose between multiple drivers, select the one with ‘cups’ in its name (these drivers should work better on Linux, CUPS meaning Common Unix Printing System). Click Forward to proceed.

In the next window you are asked if you want to transfer the current settings. Because the printer is not yet installed there are no settings to transfer, therefore, select Use the new PPD (Postscript Printer Description) as is and click on Forward.

The final step is choosing which additional options to install. These options depend on the printer model, in our example we can only install the Duplexer, a feature that allows printing on both sides of a paper. Choose the options that you want to install and click on Apply.

Now, in the Printer Properties window, the Make and Model field shows the printer correctly identified. Finally, to test the printer, click the Print Test Page button.

Читайте также:  Импортировать контакты outlook windows

You are informed that the test page was submitted. Click on OK and then close the Printer Properties window if all is good.

Conclusion

As you can see, accessing a shared printer on a network is reasonably easy to do with Ubuntu. If you have any tips for printer sharing or advanced usage of shared printers between Ubuntu and Windows 7, feel free to leave a comment. You may also want to review the articles below that can further explain the operation capabilities between Windows and Ubuntu on a network.

How To Share Printer On Network In Linux

Printing is an everyday job for us. Projects, office work, homework, etc. The basic fact is that we almost require printing every day. Now, what if we require sharing printer connected to our home Linux machine. So I decided to write a guide about it which is fairly simple. So, let’s start.

Add Your Printer To Computer

​First basic thing is to install or add your printer. Connecting printer in Linux machine is very simple as almost all Linux distros have printer supports. Open the printer app from your app menu and look if the printer has been added.

If the printer is already added or configured, it will be listed quickly on the opening printer app. If not, go to Openprinting and install your driver and again launch your printer option. Your printer should now be listed under add option, click forward on your printer config. Add the description and done. Open printer driver page has a vast variety so it is very unlikely that you don’t find your printer.

Print anything to check your printer.​Now as the printer is added let’s share it so you can access it on other systems. It is also simple. Right-click on your printer and select the shared option.

Here it is done. You have successfully shared your printer on a network in Linux. Now you will need to access it on other systems. Here is how to do it.

Accessing A Printer On Another Computer

I assume you are on LAN or somehow connected to your system from which we have shared our printer. Now here is what you have to do. Again open the printer tool as we did earlier and hit the ADD button. Your shared printer will be listed under the network printer. Click the remote hostname with the preferred printer, forward and fill out the description as we did earlier, apply and done. Voila! Print now!​

If your printer is not listed, click on a find network printer. Enter the IP address of the printer and hit find. URI would be automatically filled. Again do as the old-time fill description and apply. Done!

Conclusion

Printing is nowadays very easy on Linux based distros. You can print anywhere using a network shared printer in your favorite distros. Drivers are also no more a problem nor the old-time configuring problems. Go print the world of your dreams(just kidding, print what you need, save papers, save trees :). Happy printing.

Оцените статью