# Cannot connect to SWAT

## berhr

I am currently trying to set up samba on my Gentoo system. I have samba installed and added to the default runlevel. My current smb.conf (based off of the smb.conf.example file) checks out with testparm.

My problem lies with SWAT. I emerged xinetd, added it to the default runlevel, and edited the /etc/xinetd.d/swat file so disabled is set to no. I also successfully added the root user and password to my smbpasswd file.

However, if I attempt to connect to "http://localhost:901" in my browser, nothing happens. Mozilla shows a blank screen, and the status bar claims it's trying to contact www.localhost.com. Oddly enough, "http://localhost:631" works correctly for the CUPS web-based interface. (Although CUPS does not use xinetd to handle requests, so that might not mean anything)

I used netstat and nmap to verify that xinetd is listening on port 901 - which it is. I also tried "telnet localhost 901" and got the following output:

Trying 127.0.0.1...

Connected to localhost.localdomain.

Escape character is '^]'.

Connection closed by foreign host.

At this point, I am not sure what to do. My suspicion is that it might be a hosts.allow problem, since I have not set that file up. However, I thought I'd post here, just in case anybody with more experience than I have can positively identify the problem.

----------

## Mpemba Effect

You should have already, but make sure you have the line

```

swat            901/tcp                         # Samba configuration tool

```

in your /etc/services

can you post up a copy of your xinetd?  :Smile: 

----------

## berhr

Thanks for your response, Mpemba Effect. I double-checked /etc/services, and SWAT is in there at port 901. (I already had checked that, but I forgot to mention that in my original post).

Here is my /etc/xinetd.conf file:

defaults

{

	only_from      = localhost

	instances      = 60

	log_type       = SYSLOG authpriv info

	log_on_success = HOST PID

	log_on_failure = HOST

	cps            = 25 30

}

includedir /etc/xinetd.d

In the /etc/xinetd.d/ directory, I have a file called swat:

service swat

{

	port            = 901

	socket_type     = stream

	wait            = no

	only_from       = localhost

	user            = root

	server          = /usr/sbin/swat

	log_on_failure += USERID

	disable         = no

}

Hopefully, this information helps.

I also tried setting up hosts.allow after my original post, but that had no effect. I created a hosts.allow file, and added the line

in.xinetd: ALL

which didn't work. I then changed the line to

ALL: ALL

and that didn't work. Perhaps somebody can tell me if I misconfigured hosts.allow, or if that is not the source of problem.

----------

## Mpemba Effect

Your configs look ok. I don't think it is your hosts.allow ... although I never tried samba/swat on linux, I use it on Freebsd, AFAIK you don't need to add anything into hosts.allow.

One thing it could be is the SWAT:Linux PAM authentication. You need to create a samba file in /etc/pam.d ... apparently   :Very Happy:  ... here have a read http://samba.linuxbe.org/en/samba/learn/swat.html

----------

## berhr

Once again, thanks for the help, Mpemba Effect. I checked into the PAM stuff you mentioned and linked to. Apparently, Gentoo sets up a samba file in /ete/pam.d/. The file is not identical to the suggested file in the linked site, but I'll trust Gentoo's default here (I have not found any other posts about PAM/Samba problems in Gentoo).

So, I'm still stuck. I've tried some Google searches, but haven't found any answers to this problem that way. So, anyone got any new ideas?

----------

## hoppy

 *berhr wrote:*   

> I am currently trying to set up samba on my Gentoo system. I have samba installed and added to the default runlevel. My current smb.conf (based off of the smb.conf.example file) checks out with testparm.
> 
> My problem lies with SWAT. I emerged xinetd, added it to the default runlevel, and edited the /etc/xinetd.d/swat file so disabled is set to no. I also successfully added the root user and password to my smbpasswd file.
> 
> However, if I attempt to connect to "http://localhost:901" in my browser, nothing happens. Mozilla shows a blank screen, and the status bar claims it's trying to contact www.localhost.com. Oddly enough, "http://localhost:631" works correctly for the CUPS web-based interface. (Although CUPS does not use xinetd to handle requests, so that might not mean anything)
> ...

 

this looks to me to be more of a name resolution issue than anything else. your host doesnt seem to realise who it is. can you post your /etc/hosts and /etc/hostname files? I would add your ip address (from ifconfig) to /etc/xinet.d/swat

```
only_from       = localhost 192.168.100.20
```

and then connect in via telnet to that ip address (and 127.0.0.1). see how that goes.

----------

## thetamind

I could never get lynx to authorize with swat.  After reading the swat man page, I found an option to disable authorization.  

Add this to /etc/xinetd.d/swat.  

```
server_args     = -a
```

WARNING:  This allows anyone to use swat without logging on.  Anyone could share your entire filesystem with write permissions and then do whatever they please.

Maybe only enable this for initial setup and keep it disabled when not in use. 

Also try webmin, which has a swat section.  I still had to do this trick to use swat in webmin though.

----------

## scottro

What about just not using swat?   I remember when I first tried Samba--looked at the O'Reilly online book and Samba for Dummies (hey, water seeks it's own level, ok?)  They both mentioned swat and I didn't know enough at that point to know about allowing a firewall port or something--shucks, I don't even remember what the issue was.  At any rate, I gave up on it and thought I'd be far cooler to just modify the text files.  While doing it I thought, wow, this is pretty easy. 

I know that doesn't solve your problem, but it's a thought anyway--I have a page on samba that I put up primarily as a reminder to myself--mostly RH and Slack oriented, a few things on Gentoo (the main thing with Gentoo was printing,) at the bottom.  It's at

http://home.nyc.rr.com/computertaijutsu/samba.html

Hope that helps, even if I'm avoiding answering your question (because I don't know the answer)    :Smile: 

Scott

----------

## berhr

Hi,

Thank you everyone for your thoughts on how to fix this problem. A big thank you to hoppy - your suggestion to add my IP address to /etc/xinetd.d/swat was the solution to this problem. SWAT works just fine now.

Also thanks to thetamind and scottro for your comments. I haven't tried to use lynx with SWAT, but I'll keep the advice in mind; and it would be nice to learn the actual smb.conf file, so thanks for the tips on reading material (as if school doesn't keep me busy enough with reading  :Smile: ).

Just a recap for anyone else having this problem: add your IP address to the only_from line in the /etc/xinetd.d/swat file, and SWAT will work (assuming you've set everything else up correctly).

----------

## 2CUrious

There is still a problem when you use LDAP.   :Twisted Evil: 

I use LDAP for linux authentication. After setting this up I also started using Samba. Configured everything (/etc/xinetd.d/swat, /etc/samba/smb.conf).

and started the samba processes.

But It was impossible to 'map' my Samba shared and to connect to Swat (Bad authorization).

It  also seemed impossible to modify or create users. All the errors were about ldap.

First I tried to configure OpenLDAP and Samba so LDAP would work for Samba also. Unfortunately I did not succeed   :Confused: 

(needs more investigation...). Because I needed Samba to work urgently I changed the USE variable ldap entry in the /etc/make.conf to  -ldap 

Then did a rebuild of Samba (# emerge samba).

After that everything works okay (adding users, using swat and connecting shares). ..but case not closed yet.  Now I want Samba to use LDAP

----------

