Printer Sharing using Samba

We can share printers using samba. The servers we should install are cups and samba. After installing the servers and setting up printers connected to the server, we should have /etc/samba/smb.conf file like this:

  [global]
  workgroup = workgroup_name
  netbios name = server_name
  server string =  Print Server
  load printers = yes
  printing = cups
  printcap name = cups
  encrypt passwords = yes
  security = user
  valid users = a_valid_user_name

  [print$]
  comment = Printer Drivers
  path = /etc/samba/printer
  guest ok = no
  browseable = yes
  read only = yes
  write list = a_valid_user_name

  [printers]
  valid users = a_valid_user_name
  comment = All Printers
  path = /var/spool/samba
  browseable = no
  public = no
  guest ok = no
  writable = no
  printable = yes
  printer admin = a_valid_user_name

Here, a_valid_user_name can be a username defined in samba users. This definition can be done using

  smbpasswd -a system_user

If there are no /etc/samba/printer and /var/spool/samba directories, please create so. If you install a postscript(PS) printer, you should extract {{blog:technical:windows_drivers.tar.gz|this}} file into the directories /var/spool/samba and /etc/samba/printer . After extracting chmod these extracted files to 777 and apply this command as root:

  cupsaddsmb -H server_name -U root -h domain_name -a -v

this command will install drivers for windows computers to automagically download PS drivers when they connect to the printer.

Now, edit /etc/cups/cupsd.conf and set server_name and server admin parameters. If you want to manage cups from only the machine you are using, find the section below:

  
  AuthType Basic
  AuthClass System
  Allow From 127.0.0.1
  

and set Allow From to 127.0.0.1 . You can set this entry whatever IP you want to manage cups from.

Find /etc/cups/mime.convs and uncomment the line like following:

  application/octet-stream        application/vnd.cups-raw        0

Find /etc/cups/mime.types and uncomment the line like following:

  application/octet-stream

Now restart the servers. You should now see the shared printers on windows machines.
Good Luck!!

Leave a Reply