Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 830  / 1 Year ago, wed, march 15, 2023, 12:22:06

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


More From » vsftpd

 Answers
1

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:




[#26125] Friday, March 17, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
doredtness

Total Points: 153
Total Questions: 113
Total Answers: 106

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
;