# For the life of me I can't get SWAT to work!

## carlos123

I am trying to use the SWAT program to configure Samba and I can't connect to the 901 port despite everything I have tried.  

Among other things I have tried are the following.  

 emerged xinetd

 added my IP address to end of localhost line in /etc/xinetd.conf file.

 did an "rc-update add xinetd default"

 tried to connect through Mozilla instead of Konqueror.

 read every post that I could find on SWAT in Gentoo forum.

 pinged localhost to make sure it was there.  It was.

 used netstat to make sure port 901 was listening.  It was.

 rebooted the computer.

 used smbpasswd to add passwords for both the root and my working user.  

I know that I don't neccessarily need SWAT and can work with the Samba config file directly but I don't want to give up in defeat on yet another package that doesn't quite work under Gentoo.  It makes Gentoo look like something that can only work by using a patchwork of workarounds or alternate programs.  

Anybody got any suggestions as to how to get SWAT to work?  On my computer using Gentoo?

Thanks.  

Carlos

----------

## paul138

You need to add root to the Samba password/user file before you can log in.

```

smbpasswd -a -e root

```

Then try again.

----------

## carlos123

Thanks Paul but it didn't work.  When I tried to access "http://localhost:901" again my browser, Konqueror, returned a 

 *Quote:*   

> 
> 
> An error occured while loading http://localhost:901:
> 
> Connection to host localhost is broken
> ...

 

Here is what I did beforehand, just as you suggested....

```

pine [~] # smbpasswd -a -e root

Enabled user root.

pine [~] # smbpasswd -a -e carlos

Enabled user carlos.

pine [~] #

```

Any other suggestions?  

Thanks.  

Carlos

----------

## paul138

ohhh, sorry about that.

Try editing the file /etc/xinetd.d/swat

It'll look like this:

```

service swat

{

        port            = 901

        socket_type     = stream

        wait            = no

        only_from       = localhost

        user            = root

        server          = /usr/sbin/swat

        log_on_failure += USERID

        disable         = yes

}

```

Remove the line that says 'disable=yes' and re-start xinetd (/etc/init.d/xinetd restart)

You may also need to set the password for root by running smbpasswd as root without any options then with the other usernames (eg. smbpasswd user1).

PS - There's no shame in using SWAT, that's why it's there  :Wink: 

----------

## carlos123

Thanks again Paul but I had already done all that.  Just in case I missed something I did it again.  Still doesn't work.  Here is my attempt....

First I made sure that my /etc/xinetd.d/swat file looked like yours.  Here is mine...

```

# PER CARLOS: changed the disable value from "yes" to "no" in order to

# enable SWAT (Samba GUI).  Also added my IP to end of "only_from" line.

service swat

{

        port            = 901

        socket_type     = stream

        wait            = no

        only_from       = localhost

        user            = root

        server          = /usr/sbin/swat

        log_on_failure += USERID

#       disable         = no

}

```

The only change I made is I commented out the line I had previously changed and I removed my IP from the end of the "only_from" line.  

I then did the following...

```

pine [~] # /etc/init.d/xinetd restart

 * Stopping xinetd...                                                     [ ok ]

 * Starting xinetd...                                                     [ ok ]

pine [~] # smbpasswd

New SMB password:

Retype new SMB password:

Password changed for user root.

Password changed for user root.

pine [~] # smbpasswd carlos

New SMB password:

Retype new SMB password:

Password changed for user carlos.

Password changed for user carlos.

pine [~] # telent localhost 901

-bash: telent: command not found

pine [~] # telnet localhost 901

Trying 127.0.0.1...

Connected to localhost.localdomain.

Escape character is '^]'.

Connection closed by foreign host.

pine [~] #

```

After the above I tried browsing to "http://localhost:901" and was greeted by the previously mentioned error again.  Through Konqueror.  

Could a misconfiguration of my Apache server on my computer be screwing things up?  I never finished the configuration of Apache.  Basically it's not working yet since I have made no changes to the Apache config files.  Does anyone know what the Apache server daemon is called under Gentoo so that I can check if it's running?  

I have three instances of a process called "kio_http" running.  It's some kind of socket accessing process that started up all over the place when Konqueror crashed on me yesterday.  Maybe I'll close out that process (since it's http something or other) and try to access SWAT then.

Although it's not just Konqueror that I can't access SWAT with.  I also can't access it through Mozilla.    

Thanks.  

Carlos

----------

## paul138

No, SWAT is indipendant of Apache.

If all else fails, try installing webmin and using SWAT though it's interface.

----------

## carlos123

Thanks Paul but that's what I am trying to avoid.  Namely to throw my hands up and give up on using SWAT under Gentoo the way it's suppossed to be able to be used.  While working under other distributions like Redhat.  

I don't want to be telling others that Gentoo is great except that you can't really use <package_name> or <package_name> unless you use it through this other package here....or bend like a string of wet spaghetti all over the place with all kinds of work arounds just to get it to work...type of thing.  

The kio_http process had nothing to do with it either by the way.  It starts up whenever I refresh or access a new page inside Konqueror.  

Do you or anybody else have any other suggestions?  There is absolutely no reason why I shouldn't be able to use SWAT under Gentoo.  The way it's supposed to be usable.  At least none that I can think of.  Without resorting to workarounds and other packages (webmin being a bit bloated for what I want to do - not to mention adding another level of complexity in getting THAT package installed and configured).  

Thanks for the suggestion though Paul.  I appreciate your input very much.  

Carlos

----------

## carlos123

I just looked at the webmin interface and the amount of configuration that I would have to do (throught it's setup.sh script) just to get THAT to work is ten times what I should have to do to get SWAT to work.  

Carlos

----------

## paul138

 :Question:   emerge webmin

It's all configured. There is very little to do (if at all) for using it in conjuction with webmin. Fire it up and go to Servers > Samba > SWAT and you're good to go.

BTW, you're not using a 'firewall' script are you?

----------

## carlos123

Thanks Paul.  I did emerge it.  Unfortunately I was not able to access webmin through the name of my local computer for some reason (as explained in the webmin instructions) but on a hunch I tried "localhost" and was able to see it just fine.  

So I guess it wasn't as tough to configure under Gentoo as I thought it would be.  The webmin siite made it seem like I had to answer 10 questions on everything related to my network before being able to use it.  Seemed like the emerge took care of a lot of that!

Kinda odd that I can access SWAT through webmin but not as a standalone application.  Turns out that SWAT is not quite what I thought it was (a GUI for mounting and accessing windows shares).  

It's very limited in it's functionality so I guess it's back to the command line trying to figure out how to work with Samba. Oh well.  

Thanks for your input. 

Carlos

----------

## paul138

lol

Webmin can use it because it's acting as a wrapper for the program itself (it does not need to be a xinetd service).

As far as it being limited, try clicking open the advanced buttons. I find it very well done and documented. Even though I've been using Samba for 3 or 4 years now, I still go back to swat to save time   :Wink: 

Well, to each his own. Good luck and don't forget to check out Samba's docs on their web site, they're very good. http://www.samba.org/

ttfn

----------

## tgoodaire

If you're using for something to browse windows shares, try Konqueror! 

```

smb://MACHINENAME

```

----------

## carlos123

I FINALLY, FINALLY have figured out why so much did not seem to work right off the bat!  It had nothing to do with Gentoo (I think)!  

A while back I put a VNC server on my windows computer so that I could control that computer (upstairs) from my Linux computer (downstairs).  

Well when you mentioned that smb share thing through Konqueror togoodaire, I tried it again.  And like in the past it didn't work.  But this time the messsage that came up rang a bell.  And wouldn't you know it.  When I went to the command prompt and tried to ping my windows computer it wouldn't get through!

So I disabled the VNC server on my Windows computer and lo and behold I am able to get through now!!  Which is GREAT!  

Of course this now means that I must figure out what is wrong in using VNC.  More tinkering, and configurating, and forumizing, and command line switcherizing ahead (yuk) but at least now I can go forward in using Samba!  

Thanks again.  

Carlos

----------

## tgoodaire

I'm glad to hear that you're up and running. I don't know how vnc would interfere with samba though. Do you have vnc running on a strange port (like 139 or something)?

----------

## carlos123

I have no idea what port it is running on since it's on my Windows side that the VNC server is on.  Of course when I access it from my Linux Gentoo box it may well be that for some reason my Linux VNC client is using a port that Samba wants to use.  

I don't know how to check what port it is using but I think I better study up on ports and diagnostics for them since it seems that I am always running into some kind of port or other type of problem.  Very confusing, that port stuff.  

Carlos

----------

## tgoodaire

```

netstat -l

```

will tell you what ports are listening for incoming connections.

I believe that samba listens on ports 137 and 139. (smbd and nmbd)

----------

## carlos123

netstat -l works on Linux but not under my Windows 95.  netstat -a there shows that that computer is listening on ports 137 and 139 but that's even when VNC is not active and I am still able to connect to it from Linux.  So listening on those two ports is probably not a problem.  

When VNC is active others ports come into play and something definitely gets messed up when VNC on my Windows computer is active.  Is it safe to post the ports that Windows is listening on in an effort to track down the problem?  Or is that a security risk bearing in mind that the ports will forever remain embedded in this thread?  I am behind a NAT hardware firewall.  

Carlos

----------

## tgoodaire

What port is VNC running under?

----------

## Kulfaangaren!

 *carlos123 wrote:*   

> netstat -l works on Linux but not under my Windows 95.  netstat -a there shows that that computer is listening on ports 137 and 139 but that's even when VNC is not active and I am still able to connect to it from Linux.  So listening on those two ports is probably not a problem.  
> 
> When VNC is active others ports come into play and something definitely gets messed up when VNC on my Windows computer is active.  Is it safe to post the ports that Windows is listening on in an effort to track down the problem?  Or is that a security risk bearing in mind that the ports will forever remain embedded in this thread?  I am behind a NAT hardware firewall.  
> 
> Carlos

 

The ports 137-139 are NetBIOS ports and yes they are normal on a windows system or a system running Samba. For example UDP port 138 is for the windows naming service.

VNC servers normaly bind to ports 5800 and 5900, 5800 for the normal RFB channel (for vnc-clients) and 5900 for http requests (Java version of the vnc-client)

// Fredrik

----------

## Odin

Ran across this thread while tryin to get swat working myself.. And noticed something interesting.

xinetd is NOT working correctly, at least not on my system.. It didn't start either itself, or swat, or anything else.

I checked it out a bit, and tried to run xinetd in debug mode... (xinetd -d) Turns out its segfaulting   :Shocked: 

I am running it on PPC, but its not masked.. I dunno whats up.  :Sad: 

----------

## Stalione

See https://forums.gentoo.org/viewtopic.php?p=335207

----------

## dericmil

see: https://forums.gentoo.org/viewtopic.php?t=57924&highlight=swat

----------

