LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2016, 05:05 AM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
ftp port 20 in passive mode


I would like to know if ftp actually uses port 20 in passive mode. Having read this article (http://www.slacksite.com/other/ftp.html), I gather that it doesn't. That it uses port 21 at the beginning and then it starts using a high port. Someone knowledgeable , though, told me that it does use port 20.

Could anyone explain?

Thanks
 
Old 04-07-2016, 05:01 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,345

Rep: Reputation: Disabled
You are quite correct.

In active mode, the client specifies its IP address and port number with a PORT (or EPRT) command. The server opens a connection from port 20 to the socket in question, and this connection is then used for data transfers.

In passive mode, the client sends a PASV (or EPSV) command, and the response from the server will contain the IP address and port number of the server. Most FTP servers have a configuration parameter specifying an ephermal port range for passive connections, so the port number is not likely to be 20. The client then initiates a secondary TCP connection to the port in question.

One shouldn't expect the source port number (at the client end) of a passive connection to be 20, as FTP clients are usually run by unprivileged user accounts and aren't allowed to use "well-known" ports.

There's no technical reason why the server port number for a passive connection couldn't be 20, but according to RFC959:
Quote:
PASSIVE (PASV)
This command requests the server-DTP to "listen" on a data port (which is not its default data port) and to wait for a connection rather than initiate one upon receipt of a transfer command.
So the standard actually mandates (or at least strongly suggests) that port 20 shouldn't be used on the server side in passive mode.
 
1 members found this post helpful.
Old 04-07-2016, 02:17 PM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Thank you for your ample answer. If I were able to use either, which would be best, performance and securitywise?
 
Old 04-12-2016, 05:36 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,345

Rep: Reputation: Disabled
With regards to security and performance, active vs. passive FTP should be of no significance.

Neither provides any security, and the speed of a TCP transfer does not vary depending on which side initiated the TCP connection.
 
2 members found this post helpful.
Old 04-13-2016, 05:38 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The only purpose of the passive mode is to get around NAT routers, and allow the ftp client to transfer data.
 
1 members found this post helpful.
  


Reply

Tags
ftp



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
Help required regarding ftp passive mode in Linux sakthidasan02 Linux - General 10 03-25-2013 06:17 AM
FTP publishing, need help configuring iptables in passive mode in non-standard port vdeschamps Linux - Security 9 07-30-2011 03:11 AM
ftp @ MC : could not enter passive mode @ ftp.slackware.com brodo Slackware 3 05-19-2010 03:39 PM
ftp - active or passive mode kshkid Programming 1 02-15-2008 09:27 PM
ftp passive mode ? lenlutz Linux - Networking 1 11-05-2003 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:58 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration