Click to See Complete Forum and Search --> : How I installed swat in Redhat 7.3


dennis112
09-16-2002, 01:21 PM
After much difficulty I figured out how to install Swat and make it work in RedHat7.3. Most of this info should apply to other linux distros also.

Apparently RH7.3 does not install full support for Samba nor Swat by default. Even if you install Samba, Swat is not automatically installed. You will need to install it seperately. You can first see if Samba is installed by typing:

rpm -q samba.

If it is installed, good. If not, do the next few steps to get it going:

You will need to install the rpm for Samba (found on the 2nd of the 3 install disks): First mount your cdrom, CD to the RH RPM directory and then:

rpm -ivh samba*

In my case, parts of samba were already installed and this prevented a regular install so instead I had to force it by using:

rpm -i --force samba*

You will need to edit the smb.conf file that was installed by Samba in order to get it to work. This article is not specifically on making Samba work, and I suggest checking out other articles on how how to edit the conf file and other particulars with getting Samba running so you can use its shares. Once you install samba, be sure to make sure you turn it on (smb) in services configurator (must be run from root) and reboot if you don't know how to restart the service manually.

Now for the Swat installation. In RH7.3 theSwat RPM is called samba-swat and it was found on the 3rd disk of RH7.3. Other distros may just call it "swat" and you should use that instead of samba-swat in the below exambles. First, see if swat is already installed:

rpm -q samba-swat

If it is not there, install it using:

rpm -ivh samba-swat

Once installed, you still have a couple of items to clean up. First you should check out the swat manual that can be found at:

http://us2.samba.org/samba/docs/man/swat.8.html

It is not entirely accurate for RH7.3, but the steps are nearly the same.

In /etc/services you need to add a line at the bottom of the file, under the heading # local services, like this:

swat 901/tcp # Needed for swat

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX

NOTE: If you are NOT using a newer version of RedHat or a similar distro that uses the /etc/xinetd.conf file, you will need to edit the /etc/inetd.conf file (which is not found in RedHat7.3) and add the line found below to the bottom of the file. (You will either have xinetd.conf or inetd.conf, but shouldn't have both.)

swat stream tcp nowait.400 root /usr/sbin/swat swat

See where I put the swat directory info? It should point to the executable. Do a search for the file to be sure were it is located. Mine was found in the /usr/sbin/ directory.The double swat at the end is not a typo.

Again, the above line is not needed if your linux uses the xinetd.conf file instead. See the swat manual for additional help with inetd.conf.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX

Next you need to find where the actual swat executable file is located. Do a search for the file. Mine was located in the /usr/sbin/ directory.

Now you "may" need to create a new text file ( use your favorite text editor) called "swat" UNLESS THE FILE ALREADY EXISTS. The file should be created (or found) in the /etc/xinetd.d/ directory.

In your /etc/xinetd.d/swat file add the following info exactly as shown, including the funny parenthesis things:

## /etc/xinetd.d/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
}

Save the file.

NOTE: the server= line must point to your actual swat executable file. (server = /usr/sbin/swat is where mine is in RH7.3. Yours could be different, depending on the distro. server = /usr/local/samba/bin/swat seems to work on some so be sure to verify it!)

NOTE: the line "only_from = localhost" is optional and I suggest leaving it out of the file until after you get Swat to work without it. Not knowing this cost me a day of research and may be why many have had problems getting swat to work. Without it, you will be able to enter swat from any computer on the same network (including the linux box).

Now go to services configurator and be sure to check the swat box in order for it to load. You should also make sure that either xinetd or inetd are also checked (again, this is system dependant on which one you have). Reboot (or restart the service, if you know how). Start your favorite browser.

You should now have a working version of swat if you type http://(server):901 with (server) being the ip# assigned to your linux installation. For example I use http://127.0.0.1:901 when on my linux box and http://192.168.0.5:901 on my windows boxes. Although I could also use http://192.168.0.5:901 on my linux box, http://127.0.0.1:901 works much faster.

Once you first see the swat password screen, jump for joy!:D

Dennis

rellims2000
09-21-2002, 07:05 PM
I followed the instructions and when I attempt to access swat via mozilla at http://127.0.0.1:901/, I get a connection refused error message. I am not sure what is causing this. Any help would be appreciated.

thanks,

dennis112
09-21-2002, 07:31 PM
Originally posted by rellims2000
I followed the instructions and when I attempt to access swat via mozilla at http://127.0.0.1:901/, I get a connection refused error message. I am not sure what is causing this. Any help would be appreciated.

thanks, Did you remove this entire line?

only_from = localhost
or
only_from = (what ever is here)

If it is still there, it will give you that type of error. Also I suggest checking your passwords.

Hayl
09-21-2002, 07:45 PM
i like to do it this way :)

apt-get install swat

:)

rellims2000
09-21-2002, 10:34 PM
Thanks for the quick reply(s).

Yes I did delete the line.

I started looking around and went into services configurator and found that the services for swat and inetd were not selected to run. Once I did that, I could login to the swat console.

Now it is just a matter of connecting through my D-Link 704P gateway to my other computers.

thanks,

mark

dennis112
09-22-2002, 10:20 AM
Originally posted by rellims2000
Thanks for the quick reply(s).

Yes I did delete the line.

I started looking around and went into services configurator and found that the services for swat and inetd were not selected to run. Once I did that, I could login to the swat console.

Now it is just a matter of connecting through my D-Link 704P gateway to my other computers.

thanks,

mark
Glad you got it running!:D

In my original post, I had mentioned about going to services to start both samba and swat. I have just edited that post in order to make it more clear to future readers.

Thanks for letting me know what you found! :)

Dennis

RobW
09-23-2002, 03:03 AM
dennis112 thanks for this information, I am sure it has saved me heaps of time.

I am getting the same problem as rellims2000, after following your instructions I get a connection error. I have deleted the line as instructed and checked that both swat and xinetd are running but it hasnt helped. Not sure what to do, any ideas?

dennis112
09-23-2002, 07:41 PM
Originally posted by RobW
dennis112 thanks for this information, I am sure it has saved me heaps of time.

I am getting the same problem as rellims2000, after following your instructions I get a connection error. I have deleted the line as instructed and checked that both swat and xinetd are running but it hasnt helped. Not sure what to do, any ideas?
Thanks for the input.

Did you set a username and password for your swat? I just realized that I did not mention it in the above article. To make things simple, I use the same username and password for both start up and for swat.

RobW
09-23-2002, 07:49 PM
I think so:
smbpasswd -a
and then typing the same password twice.
Is that correct?

Thanks for your help.

pnc
09-26-2002, 04:22 PM
I'm at the same point as RobW and unable to access SWAT. I have noticed that in my Service Configuration, when I select the "swat" entry, the Start, Stop and Restart buttons are greyed out. Swat is checked to start at boot, and it doesn't fail when I boot up, but it still tells me that the connection is refused when I try to connect to 127.0.0.1:901.

Does anyone have any suggestions as to what I should do next?


my etc/xinetd.d/swat file is:

# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
service swat
{
disable = no
port = 901
socket_type = stream
wait = no
user = root
server = /usr/local/samba/bin/swat
log_on_failure += USERID
}


my etc/xinetd.conf file says:

defaults
{
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}

swat stream tcp nowait.400 root /usr/local/samba/bin/swat swat

includedir /etc/xinetd.d



and in /etc/services I have:

swat 901/tcp


I've verified that swat is in /usr/local/samba/bin/ and when I ask "rpm -q samba" it returns samba-2.2.3a-6.


I have been trying for weeks to get this to work with no success.

Any suggestions?

Thanks

RobW
09-27-2002, 02:43 AM
I finally got it working. Problems i think were:
* I thought I had swat installed when i actually only had part of it installed. I had to follow dennis112's advice on forcing a full install (why would red hat only instal part of it?)
* When I tried to access swat using 127.0.0.1:901 it wouldnt work, neither would localhost:901 I had to use: server:901, must be how I have set up my network configuration?

Good luck pnc.

dennis112
09-27-2002, 09:18 AM
Originally posted by RobW
I finally got it working. Problems i think were:
* I thought I had swat installed when i actually only had part of it installed. I had to follow dennis112's advice on forcing a full install (why would red hat only instal part of it?)
* When I tried to access swat using 127.0.0.1:901 it wouldnt work, neither would localhost:901 I had to use: server:901, must be how I have set up my network configuration?

Good luck pnc.
Glad you got it going. The force switch will install RPM's over existing files. As you found, RH7.3 installed a couple of samba files initially and that prevents a normal RPM install of Samba. If you don't want to "force" the install, you can individually remove the pre-installed Samba files using their names with no repercussions (after a fresh OS install). First to find the name of the files installed:

rpm -qa samba*

I found 2 files that were preinstalled and prevented me from properly installing samba using -ivh. One was samba-common-2.2.3a-6 and the other was samba-client-2.2.3a-6. I removed them individually by using:

rpm -e samba-client-2.2.3a-6
rpm -e samba-common-2.2.3a-6

NOTE: They have to be removed in a certain order-and I don't remember which is first. If you get an error message, do the other one first.

Now check to verify that Samba is not installed:

rpm -qa samba*

You should get a message saying that it didn't find anything. Now install Samba using the -ivh switch as above. It should install. You can check that Samba is fully installed by again typing rpm -qa samba* Afterwards, I got 4 files installed:

samba-common-xxxxxx
samba-swat-xxxxx
samba-xxxxx
samba-client-xxxxx

NOTE: xxxxx = version #'s

You must have all 4 Samba files installed before Swat will work!

If you only want to check if swat is installed, type:

rpm -q samba-swat

should return samba-swat-xxxxx

Of course, swat must be installed for it to work.

I really don't have an answer on exactly what IP to use to start swat. Seems that we have covered the 3 most common. http://127.0.0.1:901, http://server:901, and using your statically assigned host, such as http://192.168.0.5:901. There are other possiblilities, depending on your setup which may include words like localhost:901. Check your /etc/hosts file for possible clues.

Interestingly, I found that even though I had problems with getting Samba share to work properly (my nmb wasn't starting), Swat worked just fine. Another thing I found, do not add the line "swat stream tcp nowait.400 root /usr/sbin/swat swat" to the /etc/xinetd.conf file--it is not needed (it is still required in inetd though).

Good luck!

pnc
09-27-2002, 09:54 AM
Ok, I have reinstalled Samba via cvs; rpm -qa returns

samba-common-2.2.3a-6
samba-2.2.3a-6
samba-swat-2.2.3a-6
samba-client-2.2.3a-6


I have verified that the needed services are running. Both 127.0.0.1 and localhost point to me pc. And I've tried connecting through http://127.0.0.1:901 http://localhost:901 http://server:901 Nothing works, I get the same message.


Can anyone tell me how to verify that the SWAT service is running?

Thanks

dennis112
09-27-2002, 10:07 AM
Originally posted by pnc
I'm at the same point as RobW and unable to access SWAT. I have noticed that in my Service Configuration, when I select the "swat" entry, the Start, Stop and Restart buttons are greyed out.

Further testing has revealed that the line added in /etc/xinetd.conf is not needed and you may be trying to start the connection twice. Try commenting it out and reboot. I believe then you will be able to check swat in the Service Configuration area.

Originally posted by pnc Swat is checked to start at boot, and it doesn't fail when I boot up, but it still tells me that the connection is refused when I try to connect to 127.0.0.1:901.[/B]

Try other combos mentioned in the post just above, such as http://server:901. Check your hosts file as mentioned. Are you trying to connect form the linux box or a different box on the network????

Originally posted by pnc my etc/xinetd.d/swat file is:

# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
service swat
{
disable = no
port = 901
socket_type = stream
wait = no
user = root
server = /usr/local/samba/bin/swat
log_on_failure += USERID
}

I've verified that swat is in /usr/local/samba/bin/ and when I ask "rpm -q samba" it returns samba-2.2.3a-6.[/B]

Looks good if the server= line is pointing to the executable. Now verify that swat is installed.

Originally posted by pnc
and in /etc/services I have:

swat 901/tcp[/B]

Looks good also. Just make sure you have it at the bottom of the file under # Local services

Originally posted by pnc I have been trying for weeks to get this to work with no success.

Any suggestions?[/B]

I know how you feel.:rolleyes: I have only been playing in Linux for barely 3 weeks and almost everything I do in RH7.3 is a struggle. It requires lots of research, patience, and experimentation to get it right. I started this post in order to have a central place to get Swat working for others.

I suggest rereading the steps found in all these posts. I have changed some of the info in the original post and the post immediately above has some fresh info.

Perhaps you might even want to start fresh and remove samba-swat (and perhaps Samba) and then reinstall them. If you ever go to remove Samba from a working installation, be sure to save your /etc/samba/smb.conf file.

There should be enough info here to get Swat going. If not, we can keep plugging away at it because I know it is possible to get it going--with lots of persistence. :D

By the way, does your Samba work????

Good luck,

Dennis

dennis112
09-27-2002, 10:18 AM
Originally posted by pnc
Can anyone tell me how to verify that the SWAT service is running?

Thanks

Hmm, not sure how to tell yet. You can check the status of its packages with:

rpm -qs samba-swat | more

and look for the word "normal".

You can check if the 2 samba daemons are working by typing ps ax | more

Watch for smbd -D and nmbd -D to verify they are working.

Dennis

pnc
09-27-2002, 10:35 AM
SWAT Works!

It was the line in the xinetd.conf file that was causing the problem. I commented it out and everything works great now.

I took this out:

" swat stream tcp nowait.400 root /usr/sbin/swat swat "


Thanks everyone, it feels great to finally get this figured out.

dennis112
09-28-2002, 08:41 AM
Originally posted by pnc
SWAT Works!



YEAH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:D

FYI, to better help others setup swat I updated my posts in order to make it correct that only the inetd.conf file (if it exists) should have the line added and no changes are needed to the xinetd.conf file.

Having it there can cause a conflict (although I did have it running that way before so I know it is possible). :rolleyes:

Good Luck to all who try it:)

Dennis

dennis112
10-02-2002, 07:06 PM
Here is a link that I participated in that has a little more Swat troubleshooting:

http://www.linuxnewbie.org/forum/showthread.php?s=&threadid=66751

rajvir1985
10-15-2002, 11:01 PM
Hello

I have red hat 7.2
and i been trying to get samba to work for a long time. I have read what you have written in this form and did exactly what it said. When i open my browser and type in http://127.0.0.1:901 it tells me that the protocol unexpectedly died or it tells me the connection is broken. but when i ping from my linux box it works. Then why do i keep getting this error.

Thank you

czgu
10-16-2002, 11:42 AM
Too bad, RH8.0 does not have swat in its discs.

rajvir1985
10-16-2002, 08:41 PM
i have been trying to get swat to work. And i am not able to becuse it keeps on telling me that the connection is broken or it tells me that the protocol unexpectedly died. I followed all the steps from the form and it still doesent work. Can any one help me please. Oh and i have Redhat linux 7.2

Thank you

rajvir1985
10-17-2002, 11:49 PM
I do not need any more help on setting up swat. i have finaly figured it out. I had to edit my hosts.deny file. The reason that I had to do that was because i red a networking guide and it told me to put the line ALL:ALL in and when i took it out it started to work fine. So thanks for the help. But i do not need any more on this topic.