Click to See Complete Forum and Search --> : CUPS problem! "localhost:631, connection refused"!


robbow52
10-18-2003, 08:49 AM
I'm a newbie with Debian (a couple of weeks now) and I'm having a terrible time setting up CUPS printing. I'm trying to print to a printer on a Windows pc on my home network. I've installed and configured SAMBA and I've installed CUPS. I've checked settings everywhere that I can find...

My /etc/hosts file:

127.0.0.1 debian localhost


# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)


::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
debian:/etc#

A section from my /etc/network/interfaces file:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet DHCP

A section from my /etc/cups/cupsd.conf:

#Port 80
#Port 443
Port 631
Listen 127.0.0.1:631

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>

And finally, the listing from ifconfig:

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:2697 errors:0 dropped:0 overruns:0 frame:0
TX packets:2697 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:231072 (225.6 KiB) TX bytes:231072 (225.6 KiB)

I've changed various settings in various files, restarted CUPS and still when I try to connect with localhost:631 to administer CUPS (using Mozilla), I receive a "connection refused" error. I'm at my wit's end!!! I "had" it working a few days ago (I could get to the html administration utility, I couldn't get the printer working!), but gave up in frustration! Since then, I've "changed" a number of things (I'm running Woody 3.0r1) and upgraded to Gnome2.2 and xfree86 1.4. I don't "think" this had an effect on things but...

Does anyone have an idea of where I might look?

Thanks in advance for your help!

Hayl
10-18-2003, 09:01 AM
Originally posted by robbow52

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>


The problem is entirely your CUPS config per the above lines.

The "Order Deny, Allow" line sets everything to Deny except what you have "Allow" lines for below it so in effect the "Deny From All" is overriding everything to be denied from every host including local (loopback 127.0.0.1).

If you use "Order Deny, Allow" then all your lines following it should be "Allow" lines and the reverse is true if you use "Order Allow, Deny" then all of your lines below it should be "Deny" lines as the logic is reversed.

It should look like this to only allow local spooling:

<Location />
Order Deny,Allow
Allow From 127.0.0.1
</Location>


The "Allow From" lines are cumulative so if you need to add any other hosts, they can be added below the "Order Deny, Allow". (i.e.)

<Location />
Order Deny,Allow
Allow From 127.0.0.1
Allow From 192.168.0.10
Allow From 192.168.0.100
</Location>


There are other ways to specify ranges of ips, etc - all in the CUPS documentation.

(You will need to restart your CUPS daemon after you make changes)

robbow52
10-18-2003, 09:06 PM
I commented out the "Deny from all" in two locations in my cupsd.conf... Restarted CUPS and still I receive the connection refused.

I then "removed" the lines, restarted CUPS and had the same results.

Just to be sure, I rebooted and tried again and still the same. I attempt to connect to localhost:631 and I receive the "Connection refused" error.

Any thoughts? (I'd be happy to post sections of the cupsd.conf file, or the whole thing if you think you might see something?)

I don't know if it means anything but I am behind a router (cable high speed connection) and I am using DHCP for my IP addressing. But this is a "local" connection...

I also have to "manually" run "ifconfig lo 127.0.0.1 && route add -host 127.0.0.1 lo" in order to configure the local host...

Thanks again and please give me your thoughts anyone! I'm getting quite frustrated with something that should be relatively easy!

robbow52
10-19-2003, 12:56 AM
With a lot of reading and tweaking, I have fixed my CUPS problem with the "connection refused" when trying to connect with the html CUPS configuration program (localhost:631). I had to enable "hostnamelookups" in the cupsd.conf file.

The code:

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>

I left alone in both places and it seems to work fine now!

Thanks for your help!