Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I downloaded vsftpd, install and config based on this link How to Set up an FTP Server in Ubuntu Linux On my Ubuntu 12.04. But the question is how to test that?

I want to learn how to use vsftpd and I am looking for an easy graphical step by step scenario to learn that. Like a scenario which include client and server by using virtual box?

How to download a file from Ubuntu_2 in Ubuntu_1. Which both are virtual OS in Virtual box

share|improve this question
add comment

4 Answers 4

up vote 7 down vote accepted
+200

Server side

  1. Check service status

    sudo service vsftpd status
    
  2. Check its running processes

    ps ax | grep vsftpd
    

    (Command to: list all processes then filter output for vsftpd line)

    or you can use a loop to monitor its processes:

    while sleep 1 ; do clear ; ps ax | grep vsftpd ; done
    

    (Command to: wait 1 second, clear shell screen, list all processes then filter output for vsftpd line, loop again as sleep always return succefully)

  3. Check port status related to vsftpd process

    netstat -lnp | grep vsftpd
    

    (Command to: list all listening ports with port number and process id (PID) owning it then filter output for vsftpd line)

  4. Monitor server log (tail with -f to follow log updates and monitor vsftpd)

    $ tail -f /var/log/vsftpd.log
    Fri Apr 25 18:43:28 2014 [pid 2026] CONNECT: Client "127.0.0.1"
    Fri Apr 25 18:45:01 2014 [pid 2025] [sneetsher] OK LOGIN: Client "127.0.0.1"
    

Client side

(note: I run them from server just to make examples, prefer other host to check firewall settings...)

  1. ftp command with -v verbose option to show all responses from the remote server)

    $ ftp -v localhost
    Connected to localhost.
    220 (vsFTPd 3.0.2)
    Name (localhost:sneetsher):      
    331 Please specify the password.
    Password:
    230 Login successful.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> 
    
  2. FileZilla. It has very detailed log, but it sends couple commands depending on settings which not always what you want.

    Status: Resolving address of localhost
    Status: Connecting to 127.0.0.1:21...
    Status: Connection established, waiting for welcome message...
    Response:   220 (vsFTPd 3.0.2)
    Command:    USER sneetsher
    Response:   331 Please specify the password.
    Command:    PASS ********
    Response:   230 Login successful.
    Command:    SYST
    Response:   215 UNIX Type: L8
    Command:    FEAT
    Response:   211-Features:
    Response:    EPRT
    Response:    EPSV
    Response:    MDTM
    Response:    PASV
    Response:    REST STREAM
    Response:    SIZE
    Response:    TVFS
    Response:    UTF8
    Response:   211 End
    Command:    OPTS UTF8 ON
    Response:   200 Always in UTF8 mode.
    Status: Connected
    Status: Retrieving directory listing...
    Command:    PWD
    Response:   257 "/home/sneetsher"
    Command:    TYPE I
    Response:   200 Switching to Binary mode.
    Command:    PASV
    Response:   227 Entering Passive Mode (127,0,0,1,159,231).
    Command:    LIST
    Response:   150 Here comes the directory listing.
    Response:   226 Directory send OK.
    Status: Calculating timezone offset of server...
    Command:    MDTM 0000_12.04~
    Response:   213 20140208184211
    Status: Timezone offsets: Server: 0 seconds. Local: 0 seconds. Difference: 0 seconds.
    Status: Directory listing successful
    ...
    Status: Sending keep-alive command
    Command:    TYPE I
    Response:   200 Switching to Binary mode.
    

Possible testing workflow

  1. Server side: After changing vsftpd.conf, restart service (no need to reboot VBox guest)

    sudo service vsftpd restart
    
  2. Client side: It's possible to write FTP client scripts (routine tests) using yafc. Example to upload a folder:

    #!/bin/bash
    yafc <<**
    open ftp://username:password@hostname
    put -f -r folder
    close
    **
    exit 0
    

    or using ftp:

    #!/bin/sh
    HOST='ftp.users.qwest.net'
    USER='yourid'
            PASSWD='yourpw'
    FILE='file.txt'
    
    ftp -n $HOST <<END_SCRIPT
    quote USER $USER
    quote PASS $PASSWD
    put $FILE
    quit
    END_SCRIPT
    exit 0
    

Server/Client on VirtualBox guests

  • Client should be in same NAT Network, Internal Network with server.

  • Or if Server has Bridged Adapter, Client could be set with NAT, NAT Network, Bridged Adapter.

References:

share|improve this answer
add comment

You can test the VSFTPD server by the following 3 methods:

  1. On the ubuntu machine (on which you have installed VSFTPD server), open the terminal(Ctrl+Alt+T) and type 'ftp localhost'. Enter the Name and password when prompted. On success, You will get into the ftp> prompt.

    Refer: https://help.ubuntu.com/community/vsftpd

  2. Testing the Status of VSFTPD -> Run " netstat -a | grep ftp " on your server. If VSFTPD wasn’t running, there would be no output at all.

    Check this link: http://www.informit.com/articles/article.aspx?p=378136&seqNum=6

  3. From another ubuntu machine(consider it as FTP client), send or receive some files to/from your FTP server (that is , the machine on which VSFTPD is installed).

    For this, you will have to connect to FTP server from another ubuntu machine.

    Check the list of FTP commands on linux in this link: http://linux.about.com/od/commands/a/blcmdl1_ftpx.htm

share|improve this answer
add comment

On the ubuntu server, open terminal and type:

sudo service vsftpd status

if output is like (except for the pid process) :

vsftpd start/running, process 6582

then the server is running.

From another computer to check if the server is active on the default port (21):

telnet ip_server_ftp 21

the output will return if the connection has been

share|improve this answer
add comment

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.