How to list the current ftp connections?

Discussion in 'Server Operation' started by iahmedamer, Jan 17, 2012.

  1. iahmedamer

    iahmedamer New Member

    Hello,
    I need to know How to list the ""current"" ftp connections?
    I need info about who r the users/IP who use FTP on my server!


    Regards
    Ahmed Amer
    Cairo,Egypt
     
  2. bassie

    bassie New Member

    What FTP server are you using?
     
  3. epretorious

    epretorious New Member

    Connections are easy enough to track by IP:
    Code:
    [[email protected] ~]$ grep ftp /etc/services 
    ftp-data        20/tcp
    ftp-data        20/udp
    ...
    ftp             21/tcp
    ftp             21/udp          fsp fspd
    ...
    sftp            115/tcp
    sftp            115/udp
    ...
    ftp-data        20/sctp                 # FTP
    ftp             21/sctp                 # FTP
    ...
    ftps-data       989/tcp                 # ftp protocol, data, over TLS/SSL
    ftps-data       989/udp                 # ftp protocol, data, over TLS/SSL
    ftps            990/tcp                 # ftp protocol, control, over TLS/SSL
    ftps            990/udp                 # ftp protocol, control, over TLS/SSL
    Use netstat to see the open connections. e.g., For simple FTP...
    Code:
    [[email protected] ~]$ netstat -tan | grep \:21
    tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      
    tcp        0      0 :::21                       :::*                        LISTEN      
    Or, if you want confirmation about which program is using [TCP] port 21...
    Code:
    [[email protected] ~]$ sudo netstat -tanp | grep \:21
    tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      4932/pure-ftpd (SER 
    tcp        0      0 :::21                       :::*                        LISTEN      4932/pure-ftpd (SER 
    User sessions are generally trackable by searching /var/log/messages...
    Code:
    Jan 18 19:07:13 ispconfig-1 pure-ftpd: ([email protected]) [INFO] New connection from 192.168.0.26
    Jan 18 19:07:22 ispconfig-1 pure-ftpd: ([email protected]) [WARNING] Authentication failed for user [justine]
    Jan 18 19:07:30 ispconfig-1 pure-ftpd: ([email protected]) [INFO] Logout.
    Jan 18 19:07:32 ispconfig-1 pure-ftpd: ([email protected]) [INFO] New connection from 192.168.0.26
    Jan 18 19:07:44 ispconfig-1 pure-ftpd: ([email protected]) [WARNING] Authentication failed for user [eric]
     
  4. erosbk

    erosbk New Member

    If you are using ftp, you can see who is connected in real time and what type of operation is doing (upload, download) with the following command:

    pure-ftpwho
     
  5. bassie

    bassie New Member

    I'm running Proftpd. Sometimes I also use the commands "ftpwho" and ftptop".
    Hope that helps!
     

Share This Page