LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 05-02-2004, 01:44 PM   #1
twelve
LQ Newbie
 
Registered: May 2004
Posts: 8

Rep: Reputation: 0
Question Can vsftpd listen to another port? [SOLVED!!]


Is it possible to set up vsftpd to listen to another port,
say 20007, for communications instead of the default
port 20? I have more than one server behind the same IP
address and i'd like to use port forwarding in my router
to allow me to FTP into them separately. Is this possible?

Thanks!

Last edited by twelve; 05-05-2004 at 09:10 PM.
 
Old 05-02-2004, 01:47 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Welcome to LQ.

You can set it up in the hosts file but you would be better just forwarding from port 20007 external to port 21 internal then you don't have to change the way vsftpd runs.
 
Old 05-05-2004, 12:18 PM   #3
twelve
LQ Newbie
 
Registered: May 2004
Posts: 8

Original Poster
Rep: Reputation: 0
thank you very much for your help. could you be a little more
specific on this internal forwarding? is this something i need to
set up on the server itself? if my router forwards data from
port 20007 to my server, say at 192.168.1.2, then i guess there
is something on my server which forwards packets from port
20007 to port 20? is this done using iptables? is there some
config file i must edit? if you can just point me to it, i'll learn what
i need to make the change myself.

this site is such an incredible service!!

thanks!
 
Old 05-05-2004, 12:47 PM   #4
adm1329
Member
 
Registered: Mar 2004
Distribution: CentOS 5
Posts: 128

Rep: Reputation: 17
you should be able to set your router up to forward anything coming in on port 20007 to 192.168.1.2 port 20. If you're not sure how, post what brand and model router you have and I'm sure someone can help you.
 
Old 05-05-2004, 12:54 PM   #5
twelve
LQ Newbie
 
Registered: May 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by adm1329
you should be able to set your router up to forward anything coming in on port 20007 to 192.168.1.2 port 20. If you're not sure how, post what brand and model router you have and I'm sure someone can help you.
thanks, i'll try that method. one other tidbit - is port 20 all i need to worry
about forwarding? i have seen port 21 listed as an FTP data port. I know
little about the workings of FTP, does 20 just do the talking and 21 the xfering?

thanks
 
Old 05-05-2004, 01:38 PM   #6
adm1329
Member
 
Registered: Mar 2004
Distribution: CentOS 5
Posts: 128

Rep: Reputation: 17
FTP Control Channel - TCP Port 21
All commands you send and the ftp server's responses to those commands will go over the control connection, but any data sent back (such as "ls" directory lists or actual file data in either direction) will go over the data connection.
FTP Data Channel - TCP Port 20
Used for all data sent between the client and server.
http://www.siliconvalleyccie.com/lin...ftp-server.htm

So yeah port 21 has to be accessible as well, not sure if 20 actually has to be don't remember opening it on any firewalls before, but maybe that's why my ftp server is so terribly slow.


after a little research I figured my problem out. I'm still not sure you have to forward port 20 since it's not open on my firewall and my connection works fine, but with vsftp you do want to add
Code:
IPTABLES_MODULES="ip_conntrack_ftp"
to the iptables-config file.

Last edited by adm1329; 05-05-2004 at 01:58 PM.
 
Old 05-05-2004, 03:32 PM   #7
twelve
LQ Newbie
 
Registered: May 2004
Posts: 8

Original Poster
Rep: Reputation: 0
thanks for hanging with me on this. i can't seem to find a file called iptables-config. i am using RH9. here's an update of my situation:

server local ip: 192.168.1.3
vsftp running as usual on port 21.

in my nat iptable i have this: (using iptables -L -t nat)

target prot opt source destination
DNAT tcp -- anywhere 192.168.1.3 tcp dpt:20007 to:192.168.1.3:21


when i type:
# ftp 192.168.1.3 i connect
# ftp 192.168.1.3 21 i connect
# ftp 192.168.1.3 20007 connection refused

just to be sure i have temporarily flushed my FORWARD, INPUT,
and OUTPUT iptables incase they were blocking anything. still
nothing. any ideas?

thanks
 
Old 05-05-2004, 07:24 PM   #8
adm1329
Member
 
Registered: Mar 2004
Distribution: CentOS 5
Posts: 128

Rep: Reputation: 17
ok, I'm not sure how to forward port 20007 to port 21 on the same machine

If you can you need to set your router (I just noticed that it isn't possible on my router), not your iptables firewall, to redirect the port. Then when you connect to external ip xxx.xxx.xxx:20007 it redirects to your internal ip 192.168.1.3:21.
 
Old 05-05-2004, 08:06 PM   #9
twelve
LQ Newbie
 
Registered: May 2004
Posts: 8

Original Poster
Rep: Reputation: 0
yeah i don't seem to be able to make it work internally either. thanks for all your help on the subject anyway, i really appreciate it!

thanks
 
Old 05-05-2004, 09:13 PM   #10
twelve
LQ Newbie
 
Registered: May 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Geez! It was so blindingly easy (but not so easy to find!) The port for vsftpd CAN be changed in it's config file (although it's not documented *in* the config file or man page or or or) for my problem, trying to get vsftpd to answer to port 20007, simply add this line to the /etc/vsftpd/vsftpd.conf file:

listen_port=20007

!!!

i found this gem here:
http://www.vsftpdrocks.org/faq/

works like a charm and no iptabling!!

thanks to everyone who helped me anyway!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Port 80 listen without WebServer? hacinn Linux - Security 5 06-30-2004 10:52 PM
Port won't Listen dvong3 Linux - Networking 4 05-12-2004 01:18 PM
VSftpd cant login when using inetd, but can when using listen=YES ToMMY2ooo Linux - Software 0 05-05-2004 07:53 AM
How to make a program to listen on a Particular port palanisaravanan Linux - General 4 04-14-2004 07:43 PM
how to change wu-ftp listen port? jamil5454 Linux - Networking 3 01-05-2004 08:07 AM


All times are GMT -5. The time now is 10:10 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration