# (FTP-PROBLEM) *pulls out hair*

## arachn1d

AHHHHHHHHHH!

No matter what I keep getting this problem with ftp. Right now im using pure-ftpd because its easy to setup.

Anyway all fo the sudden my FTP access will be 

"Connection refused by target machine"

This is random, one day it iwll work. One day it wont, sometimes it fixes then sometimes it wont. PLEASE HELP!

----------

## adaptr

What problem ?

Some actual info would be nice.

----------

## arachn1d

```
    Resolving host name 192.168.1.119...

    Connecting to (192.168.1.119) ->  IP: 192.168.1.119 PORT: 21

    No connection could be made because the target machine actively refused it.

    Cannot login waiting to retry (30s)...
```

----------

## adaptr

Did you install iptables ?

If so, do an

```
iptables -L

iptables -t nat -L
```

to see whether that is the problem.

Have you modified the /etc/ftpaccess or /etc/ftpusers files ?

----------

## arachn1d

there are no rules for iptables.

I have not modified those files.

I do not even have those files.

----------

## oracleofmist

use proftp... i had the same issues with pure-ftp and proftp worked right out of the box and i just configured it as i felt like it

----------

## arachn1d

can you give me a sample config?

I tried but... it didn't work. Guess I configed it wrong.

----------

## arachn1d

i tried it with proftpd with a config that should almost definitley work and it still gives me the same error :-\

----------

## arachn1d

if i telnet to my localip (from the main machine) it will work.

if i connect from this machine from telnet it says connection refused.

----------

## arachn1d

(bump)

----------

## gnuageux

I hate to ask it, but youve verified that your ftp service is running when you attempt to connect right?

----------

## arachn1d

yes

telnet 192.168.1.119 21

says this

```

 telnet 192.168.1.119 21

Trying 192.168.1.119...

Connected to 192.168.1.119.

Escape character is '^]'.

220---------- Welcome to Pure-FTPd [TLS] ----------

220-You are user number 1 of 30 allowed.

220-Local time is now 15:33. Server port: 21.

220 You will be disconnected after 15 minutes of inactivity.

```

----------

## adaptr

Have you thoroughly checked your network setup ?

Correct addresses in /etc/hosts, DNS setup, routing etc.

----------

## arachn1d

someone please help...

----------

## arachn1d

ahhh please IM BEGGING ANYONE PLEASE JUST HELP ME!!!!  :Evil or Very Mad:  i'm really desperate i have no idea what to do...

----------

## Ateo

Here is the config file that runs my proftpd server.

HTH

```
ServerName ftp.******.net

ServerType          standalone

DefaultServer on

DefaultRoot /mnt/public users

RequireValidShell   off

AuthPAM             off

AuthPAMConfig       ftp

Port 21

Umask 022

MaxInstances         30

User            proftpd

Group            proftpd

<Directory />

AllowOverwrite off

AllowRetrieveRestart on

AllowStoreRestart on

</Directory>

<Anonymous /storage/portage/distfiles>

AnonRequirePassword off

User ftp

Group ftp

UserAlias anonymous ftp

AuthAliasOnly on

RequireValidShell off

MaxClients 10

DisplayLogin welcome.msg

DisplayFirstChdir .message

<Directory /storage/portage/distfiles>

   <Limit STOR CWD READ>

        DenyAll

     </Limit>

     <Limit RMD DELE MKD>

        DenyAll

   </Limit>

  </Directory>

RootLogin off

</Anonymous>

<Global>

AllowForeignAddress off

AllowRetrieveRestart on

AllowStoreRestart off

IdentLookups off

DefaultChdir /storage/public

DefaultRoot /storage/public users

DefaultRoot /storage/portage/distfiles ftp

RootLogin off

</Global>

MaxInstances 10

TimeoutIdle 900

UseReverseDNS off

ServerAdmin root@******.net

Bind 192.168.4.253

```

----------

## arachn1d

same error

----------

## Ateo

After starting the server, is it actually running? To verify that it is, do:

```
nmap -sT localhost
```

Hopefully the daemon didn't crap out right after you start it, which is possible.

Sorry if you find this redundant.

----------

## arachn1d

port 21 is not open.

----------

## Ateo

If you have started the server yet port 21 is not open, then it's probably an issue with the daemon and not the config. What version of proftpd? Have you tried the previous version? I'm sure you have done this.... have you recompiled it?

----------

## arachn1d

im using pure-ftpd right now.

same problem with any ftp server.

----------

## arachn1d

now why would this happen?

----------

## fleed

Check if there's any daemon listening on that port, some leftover daemon that was not killed. Do netstat -tlnp | grep 21 to check. Try connecting with a different machine, or if that is not possible try a different client ftp. Try posting your logs for us to check, etc, etc.

----------

## arachn1d

netstat -tlnp | grep 21

tcp        0      0 192.168.1.119:21        0.0.0.0:*               LISTEN      22189/pure-ftpd (SE

i dont have any logs regarding ftp in /var/log

----------

## Rainmaker

can you do a portscan from the machine you're trying to connect from?

----------

## arachn1d

no but that shouldn't matter.

----------

## arachn1d

here look at this

its weird..

notice the scans one is localip one is localhost

```

arachn1d@server arachn1d $ nmap -sT 192.168.1.119

(The 1653 ports scanned but not shown below are in state: closed)

PORT      STATE SERVICE

21/tcp    open  ftp

22/tcp    open  ssh

80/tcp    open  http

143/tcp   open  imap

993/tcp   open  imaps

10000/tcp open  snet-sensor-mgmt

Nmap run completed -- 1 IP address (1 host up) scanned in 0.646 seconds

arachn1d@server arachn1d $ nmap -sT localhost

Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2004-07-11 17:45 PDT

Interesting ports on localhost (127.0.0.1):

(The 1654 ports scanned but not shown below are in state: closed)

PORT      STATE SERVICE

25/tcp    open  smtp

80/tcp    open  http

143/tcp   open  imap

993/tcp   open  imaps

10000/tcp open  snet-sensor-mgmt

Nmap run completed -- 1 IP address (1 host up) scanned in 0.452 seconds

arachn1d@server arachn1d $

```

----------

## arachn1d

i upgraded my kernel to 2.6.7-r8 it was r6 and i could ftp...

I do not think this fixed it but rather the "reboot"...

But I am not sure, and I will most likely not find out.

Maybe the nmap is some clue?

It still has the same thing...

```

nmap -sT 192.168.1.119

Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2004-07-11 19:14 PDT

Interesting ports on 192.168.1.119:

(The 1653 ports scanned but not shown below are in state: closed)

PORT      STATE SERVICE

21/tcp    open  ftp

22/tcp    open  ssh

80/tcp    open  http

143/tcp   open  imap

993/tcp   open  imaps

10000/tcp open  snet-sensor-mgmt

Nmap run completed -- 1 IP address (1 host up) scanned in 0.465 seconds

```

```

nmap -sT localhost

Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2004-07-11 19:14 PDT

Interesting ports on localhost (127.0.0.1):

(The 1654 ports scanned but not shown below are in state: closed)

PORT      STATE SERVICE

25/tcp    open  smtp

80/tcp    open  http

143/tcp   open  imap

993/tcp   open  imaps

10000/tcp open  snet-sensor-mgmt

Nmap run completed -- 1 IP address (1 host up) scanned in 0.486 seconds

```

weird no? everything works now too.

----------

## adaptr

What is in your /etc/hosts file ?

It is most likely incorrect.

----------

## arachn1d

127.0.0.1       localhost               wtf-dude.com

127.0.0.1       server.wtf-dude.com     server

#192.168.1.119  server.wtf-dude.com     server

# IPV6 versions of localhost and co

::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

----------

## adaptr

That is not a good idea.

Never touch the first line:

```
127.0.0.1 localhost.localdomain localhost
```

Instead, use additional lines for your IP addresses and hostnames:

```
192.168.1.119 server.wtf-dude.com server
```

And lose the IPv6 stuff (unless you actually use it, which is unlikely.)

----------

## arachn1d

k how do i restart hosts? i did this>>

```

127.0.0.1       localhost.localdomain   localhost

192.168.1.119   server.wtf-dude.com     wtf-dude.com

#127.0.0.1      localhost               wtf-dude.com

#127.0.0.1      server.wtf-dude.com     server

#192.168.1.119  server.wtf-dude.com     server

```

----------

## adaptr

You don't have to - if you don't run a nameserver for that host then the changes are instant.

----------

## arachn1d

when i changed my configuration my postfix got screwed up...

anyway the ftp got borked again  :Sad: 

----------

## adaptr

Hokay, let's take it from the top:

```
emerge unmerge pure-ftpd

emerge proftpd
```

Then we'll see what's what...

----------

## arachn1d

now what

----------

## arachn1d

wow guess what.. its not related to my server its my actual local machine.

I can't connect to ANY ftp.... weird...

anyone know what would cause this on xp?

(gonna boot to gentoo partition and see if it works)

----------

## Arcanum

Do you have the Windows XP firewall enabled?  Is it possible it's blocking the connection?

----------

## arachn1d

nope...  :Rolling Eyes: 

----------

