How do I check which FTP (Passive or Active) is running?
By default, passive FTP is running in linux, but how do I check?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityHow do I check which FTP (Passive or Active) is running?
By default, passive FTP is running in linux, but how do I check?
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
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"
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.
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.
passive
it's says passive off.