Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How do I check which FTP (Passive or Active) is running?

By default, passive FTP is running in linux, but how do I check?

share|improve this question
2  
Your question is very vague. Do you download via FTP or do you run a FTP server? –  jofel Dec 12 '12 at 13:41
    
@Rahul Patil Does my answer fit your question? If so please consider accepting my answer. –  John Siu Dec 18 '12 at 17:34
    
after enter again passive it's says passive off. –  Rahul Patil Dec 19 '12 at 4:35

2 Answers 2

From ftp client, to check if remote ftp server support passive mode, after login, type quote PASV.

Following are connection examples to a vsftpd server with passive mode on and off

vsftpd with pasv_enable=NO

# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.3.5)
Name (localhost:john): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quote PASV
550 Permission denied.
ftp> 

vsftpd with pasv_enable=YES

# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.3.5)
Name (localhost:john): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quote PASV
227 Entering Passive Mode (127,0,0,1,173,104).
ftp> 

The ftp command quote send all arguments following it to remote server. Remote server will process them as command/request if applicable. PASV is a request for server to use passive mode.

share|improve this answer
    
even "pasv_enable=NO" in vsftpd.conf , the passive command says passive mode on. –  Rahul Patil Dec 19 '12 at 4:46
    
Did you test it behind a nat router? If you can download file, then it is actually on. Another way is force your ftp client to use passive mode only and test it. –  John Siu Dec 19 '12 at 4:52
    
Hi John, Please check above post and let me know if i am wrong –  Rahul Patil Dec 19 '12 at 5:16
    
--> thanks for your efforts. –  Rahul Patil Dec 19 '12 at 15:14
    
@RahulPatil yes, you are correct. My original answer only set passive mode on client side. I revised my answer with the correct way. You info / method is also correct. –  John Siu Dec 19 '12 at 15:16
up vote 1 down vote accepted

I found the answer as below.

in passive mode we can run ls command but in active mode we have to manually disable passive mode by typing passive command then it will accept ls command otherwise it's gives 550 permission denied error . see below (pasv_enable=NO in vsftpd.conf)

ftp> passive
Passive mode on.
ftp> ls
550 Permission denied.
Passive mode refused.
ftp> passive
Passive mode off.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r--    1 503      503             0 Jan 11  2013 files1
-rw-rw-r--    1 503      503             0 Jan 11  2013 files10
-rw-rw-r--    1 503      503             0 Jan 11  2013 files2
-rw-rw-r--    1 503      503             0 Jan 11  2013 files3
-rw-rw-r--    1 503      503             0 Jan 11  2013 files4
-rw-rw-r--    1 503      503             0 Jan 11  2013 files5
-rw-rw-r--    1 503      503             0 Jan 11  2013 files6
-rw-rw-r--    1 503      503             0 Jan 11  2013 files7
-rw-rw-r--    1 503      503             0 Jan 11  2013 files8
-rw-rw-r--    1 503      503             0 Jan 11  2013 files9
-rw-r--r--    1 0        0           10240 Jan 11  2013 test.tar
226 Directory send OK.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r--    1 503      503             0 Jan 11  2013 files1
-rw-rw-r--    1 503      503             0 Jan 11  2013 files10
-rw-rw-r--    1 503      503             0 Jan 11  2013 files2
-rw-rw-r--    1 503      503             0 Jan 11  2013 files3
-rw-rw-r--    1 503      503             0 Jan 11  2013 files4
-rw-rw-r--    1 503      503             0 Jan 11  2013 files5
-rw-rw-r--    1 503      503             0 Jan 11  2013 files6
-rw-rw-r--    1 503      503             0 Jan 11  2013 files7
-rw-rw-r--    1 503      503             0 Jan 11  2013 files8
-rw-rw-r--    1 503      503             0 Jan 11  2013 files9
-rw-r--r--    1 0        0           10240 Jan 11  2013 test.tar
226 Directory send OK.

ls listing that we asked for on the server comes back over the port 20 on the server to a high port connection on the client. No use of port 21 on the server is made to send back the results of the ls command on the server.

above is extracted from "http://www.markus-gattol.name/ws/vsftpd.html"

share|improve this answer
    
Agree, passive with ls within the client is an easy way to check. Actually, if we can send "PASV" to the server, the server will reply the answer. But I can't find the command within ftp client to do it. –  John Siu Dec 19 '12 at 5:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.