View Full Version : FTP Server Behind Router
20th January 2006, 10:03
I have set up Fedora Core 4 as a server (httpd, mysql and ftp). This server is behind a router. I have set port redirection on this router for ports 80, 20 and 21 to the server's local IP Address (192.168.1.100). I have subscribed to dyndns.com to resolve my dynamic ip to a fix named url. That works just fine.
I don't have problems accessing the web pages on the server locally and from the internet.
My problem is on FTP. I can do ftp from another machine in my local network by typing $ftp 192.168.1.100. However, I cannot do the same thing from the internet by typing $ftp <dyndns fix named url>:21.
20th January 2006, 10:27
Thats a common problem with FTP behind NAT as FTP tries to initiate a second connection on higher ports after initial connect. Have you tried both, passive and active FTP mode?
20th January 2006, 23:45
Guys Im having Same Problem 2 ive got two server behind router the first one is on standar port 21 and the second one is on non-standard por which is 7511 on second one when i connect i get errors when it enters PASV MODE ive also tried PORT but no hope any soloutions?
im using debian 3.1 sarge and pureftpd
21st January 2006, 08:27
Have you tried active mode?
21st January 2006, 09:04
You are behind a firewall which means tht you need to enable Passive FTP properly.
Edit /etc/proftpd.conf or whatever your conf file is:
PassivePorts 40000 40100
Edit /etc/vsftpd.conf or whatever your conf file is:
Note that you are opening up ports 40000 -> 40100 for Passive connections... therefore you need to also open up these ports on your firewall. You will then have no problems (but you will need to enable passive ftp in your ftp cient.
Does that work?
22nd January 2006, 13:44
Yes That Worked For Proftpd But I need To Know How To I Add users In Vsftpd And How Do I Change The Port In Pureftpd?
22nd January 2006, 14:26
FTP users in vsftpd are in most cases sytem users. Add a system user and try to login with that user.
If pureftpd reads its configuration from a mySQL database, you will have to add the users accounts there.
You may have a look at this howto too:
22nd January 2006, 15:31
ive changed vsftpd Configuration But Its Not Working when i conenct to the server It Gives Me :
Status: Connecting to 220.127.116.11:7511 ...
Status: Connected with 18.104.22.168:7511. Waiting for welcome message...
Response: 220 (vsFTPd 2.0.4)
Command: USER anonymous
Response: 331 Please specify the password.
Command: PASS *****
Response: 230 Login successful.
Response: REST STREAM
Response: 211 End
Response: 215 UNIX Type: L8
Status: Retrieving directory listing...
Response: 257 "/"
Command: TYPE A
Response: 200 Switching to ASCII mode.
Response: 227 Entering Passive Mode (192,168,2,79,49,160)
Error: Transfer channel can't be opened. Reason: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Error: Could not retrieve directory listing
ive alos opened ports for pasv Mode in my router But Not Working
Here is my vsftpd.conf file
# Example config file /etc/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
# Uncomment this to allow local users to log in.
# Uncomment this to enable any form of FTP write command.
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
# Activate logging of uploads/downloads.
# Make sure PORT transfer connections originate from port 20 (ftp-data).
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# You may override where the log file goes if you like. The default is shown
# If you want, you can have your log file in standard ftpd xferlog format
# You may change the default value for timing out an idle session.
# You may change the default value for timing out a data connection.
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
# (default follows)
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (default follows)
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
after ive added last lines for pasv mode i get following errors wgen i start vsftpd
host:# 500 OOPS: could not bind listening IPv4 socket
+ Exit 1 /usr/local/sbin/vsftpd
22nd January 2006, 21:14
Yes.... that is interesting. I am assuming that since you're asking about "vsftpd" and "pureftpd" that you are running both on this machine, yes? Plus you are using an alternate port in your 'listen_port' option. That being said, is it possible that you could try stopping all other ftp servers and try restarting vsftpd again. It might be that the passive_address setting is binding to port 21 and overriding the 'listen_port' option.
just a theory.
1st August 2010, 14:18
try active mode , it had solved a similar problem for me in the past with a linksys e2000 (http://www.howtoforge.com/forums/showthread.php?t=32957)
routers compare (http://www.wireless-reviews.com)
vBulletin® v3.8.7, Copyright ©2000-2014, vBulletin Solutions, Inc.