# Samba Configuration

## Fred Krogh

I'd like to able to print to a printer attached to a Linux machine from a windows machine.  I'm having trouble seeing just what should be in the configuration files.  The various howto's are slightly different and some of things I've tried have even kept samba from starting.  The printer in question is a Samsung M2625D Series (With Duplexer).  So I'm giving a minimal configuration file here the hopes someone will help to fill in what is missing.  Any additional discussion on what has to be done on the windows (1) end would also be most welcome.  Many Thanks,

Fred

```
[global]

   security = user

   os level = 20

   printer = Sam

   workgroup = crowsnest

   path = /var/spool/samba

   dns proxy = no 

   socket options = TCP_NODELAY

   remote announce = 192.168.1.11 192.168.1.2

   max log size = 10

   log file = /var/log/samba/log.%m

   printcap name = /etc/printcap

   default = printers

   hosts allow = 192.168.1. 127.

   printing = cups

   load printers = yes

   netbios name = mon1

[homes]

   comment = Home Directories

   browseable = no

   writable = yes

[printers]

   comment = All Printers

   path = /var/lib/samba

   browseable = yes

   guest ok = yes

   writable = no

   printable = yes

```

----------

## Anon-E-moose

This is from the default smb.conf file

```
# NOTE: If you have a BSD-style print system there is no need to 

# specifically define each individual printer

[printers]

   comment = All Printers

   path = /var/spool/samba

   browseable = no

   guest ok = yes

   writable = no

   printable = yes
```

Whatever path that you use should be world writable with sticky bit set

```
drwxrwxrwt 1 root root 40 Jun  1 10:40 /var/spool/samba/
```

From the windows side, it should see a share named "printers"

Edit to add: "man smb.conf" talks a little about printers.

----------

## Fred Krogh

Thanks for the suggestions which I have followed.   But I see no way to get to the printer on the windows side.  I suspect the problem has to do with the  windows side (which I really don't know very well), but of course I can't say for sure that the problem is not on the linux side.  Ideas very welcome.

----------

## Anon-E-moose

what is your max_protocol set in smb.conf?

Mine

```
   max protocol = SMB2
```

Windows 7 doesn't have a problem seeing my hard drive shares, I use a network printer, so I can't help on that.

----------

## Fred Krogh

I didn't have anything set for max protocol, just added as per your suggestion.  Windows still does not see the printer, although that may be because I don't know how to tell it to look.

----------

## Anon-E-moose

Not sure what version of windows you're using.

Under Win7, if I go to control panel and select devices and printers it shows my network printer (under printers and faxes)

Also if you change things in the smb.conf file you need to stop and restart the samba service "/etc/init.d/samba restart" as root

----------

## Fred Krogh

I'm interfacing with Windows 10.  And of course restart samba when changing smb.conf.  Windows doesn't see any printers on the network.

----------

## Anon-E-moose

Not sure how you have win10 set up, but if you're using workgroups it needs to be in the same one as samba usually "WORKGROUP"

If you've set up homegroups then I'm not sure how you find the printer. 

Probably take some googling to figure it out, start with googling "samba win10 printer" and see there's some helpful hints.

----------

## Fitzcarraldo

If you're using Windows 10, perhaps your problem is because of the following:

 *Quote:*   

> Microsoft removed the Homegroup functionality from Windows 10 version 1803; the issue, however, may affect non-Homegroup PCs and PCs that used the Homegroup functionality that Windows provided.
> 
> Usually, you should be able to access devices in the network through their IP address or name, but this may not work properly anymore in Windows 10 version 1803.

 

Ref. https://www.ghacks.net/2018/04/17/fix-pcs-no-longer-recognized-in-network-after-windows-10-version-1803-upgrade/

The fix given in that article may help you.

Another possibility mentioned in the above article is the following:

 *Quote:*   

>  Microsoft disabled the application-layer network protocol Server Message Block 1.0 in the Fall Creators Update.

 

The modification to Windows 10 given in the following article might also help if that is the cause:

https://www.amixa.com/blog/2017/12/04/cannot-browse-network-neighborhood-under-windows-10-fall-creators-update-1709-and-newer/

----------

## Fred Krogh

Many thanks for the suggestions.    It has got me a bit further before reversing direction.  There are three machines that could be listed: hplt (laptop I'm trying to get print working on), mon1 (the machine running samba, and amv (another windows 10 machine on the network.  "network" in the file manager in hplt can show:  hplt, or hplt, amv, mon1, or hplt, hplt, amv, mon1.  At the moment it just shows hplt.  When it did show mon1, it couldn't access it.  When it showed amv, I got foiled by a bad password.  I'm not seeing any pattern in what happens.  Sometimes a reboot changes things sometimes it doesn't.  It seem that windows is a lot more "fun" than linux.  You have so many ways to see it do strange things.  Of course my current problems could be in samba.  Just for giggles this is what is currently not working. 

```
# testparm

Load smb config files from /etc/samba/smb.conf

Processing section "[homes]"

Processing section "[printers]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters

[global]

   default service = printers

   dns proxy = No

   log file = /var/log/samba/log.%m

   max log size = 10

   printcap name = /etc/printcap

   remote announce = 192.168.1.11 192.168.1.2 192.168.1.4

   security = USER

   server max protocol = SMB2

   workgroup = CROWSNEST

   idmap config * : backend = tdb

   hosts allow = 192.168.1. 127.

   path = /var/spool/samba

   printer name = Sam

[homes]

   browseable = No

   comment = Home Directories

   read only = No

[printers]

   browseable = No

   comment = All Printers

   guest ok = Yes

   printable = Yes

```

----------

## gerdesj

That's quite a full on smb.conf.  I suggest that you remove all those remote announce, host allow and protocol max related things (for example Win 10 will try to do SMB 3 by default).  Get rid of default service as well ... keep things simple.

Now look at your printing system on its own - CUPS.  Windows can happily print to IPP printers for example without invoking Samba.  CUPS by default will advertise attached printers to the local LAN.  You also happen to have a full on traditional Unix printing system provided by CUPS.  Again Windows can print to that.  You only really *need* Samba for things like delivering printer drivers to Windows clients.

Start by becoming a CUPS expert and then worry about Samba ...

Cheers

Jon

----------

## Fred Krogh

I've tried your suggestions, and also tried without samba running.  I have no idea whether the problem is at the linux end or the windows end.  On the chance that it might mean something to someone ...

```
# netstat -tupln|grep 631

tcp        0      0 0.0.0.0:631             0.0.0.0:*               LISTEN      36678/cupsd         

tcp6       0      0 :::631                  :::*                    LISTEN      36678/cupsd         
```

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]

----------

