Skip to content

Instantly share code, notes, and snippets.

@manojkumararyan
Last active August 29, 2018 04:41
Show Gist options
  • Save manojkumararyan/0191f639d7a32be6576f682c8e5208ad to your computer and use it in GitHub Desktop.
Save manojkumararyan/0191f639d7a32be6576f682c8e5208ad to your computer and use it in GitHub Desktop.

Revisions

  1. manojkumararyan revised this gist Aug 28, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,7 @@ TCP 1024 to 1048 #if enable passive mode
    ### Test FTP connection
    ```
    ftp <Hostname or Server IP Address> #for normal terminal test
    #for test using ruby
    require 'net/ftp'
    ftp = Net::FTP.new
  2. manojkumararyan revised this gist Aug 28, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ TCP 1024 to 1048 #if enable passive mode
    ```
    ### Test FTP connection
    ```
    ftp <Hostname or Server IP Address> *for normal terminal test*
    ftp <Hostname or Server IP Address> #for normal terminal test
    #for test using ruby
    require 'net/ftp'
    ftp = Net::FTP.new
  3. manojkumararyan revised this gist Aug 28, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ TCP 1024 to 1048 #if enable passive mode
    ```
    ### Test FTP connection
    ```
    ftp <Hostname or Server IP Address> #for normal terminal test
    ftp <Hostname or Server IP Address> *for normal terminal test*
    #for test using ruby
    require 'net/ftp'
    ftp = Net::FTP.new
  4. manojkumararyan revised this gist Aug 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,7 @@ ftp.getbinaryfile(<remote file>, <local file>) #download file
    #sometime PASV(passive mode) fails for some server then EPSV(extended passive mode) is used
    #to overwrite 'makepasv' in Net::FTP
    epsv.rb
    #file epsv.rb
    require 'net/ftp'
    module Net
  5. manojkumararyan revised this gist Aug 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -46,7 +46,7 @@ TCP 1024 to 1048 #if enable passive mode
    ### Test FTP connection
    ```
    ftp <Hostname or Server IP Address> #for normal terminal test
    #for test via ruby on rails
    #for test using ruby
    require 'net/ftp'
    ftp = Net::FTP.new
    ftp.connect(<Hostname or Server IP Address>, 21)
  6. manojkumararyan revised this gist Aug 27, 2018. 1 changed file with 30 additions and 0 deletions.
    30 changes: 30 additions & 0 deletions configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -42,5 +42,35 @@ TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
    sudo service vsftpd restart
    ```
    ### Test FTP connection
    ```
    ftp <Hostname or Server IP Address> #for normal terminal test
    #for test via ruby on rails
    require 'net/ftp'
    ftp = Net::FTP.new
    ftp.connect(<Hostname or Server IP Address>, 21)
    ftp.login(<ftpuser>,<ftpuser password>)
    ftp.passive = true
    ftp.getbinaryfile(<remote file>, <local file>) #download file
    #sometime PASV(passive mode) fails for some server then EPSV(extended passive mode) is used
    #to overwrite 'makepasv' in Net::FTP
    epsv.rb
    require 'net/ftp'
    module Net
    class FTP
    def makepasv
    if @sock.peeraddr[0] == 'AF_INET'
    host, port = parse229(sendcmd('EPSV'))
    else
    host, port = parse227(sendcmd('EPSV'))
    end
    return host, port
    end
    end
    end
    ```
    ### Done!
  7. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,7 @@ sudo nano /etc/vsftpd.conf
    write_enable=YES #for write access
    local_umask=022
    chroot_local_user=YES #chroot_local_user is to restrict local user to their home directories. (/home/{user}/)
    #Add these lines at bottom of the file
    allow_writeable_chroot=YES
    pasv_enable=Yes
  8. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -26,10 +26,10 @@ sudo nano /etc/vsftpd.conf
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>
    ```
    ### Create FTP User and allow login access to nologin shell
    ### Create FTP user & allow login access to nologin shell
    ```
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    sudo useradd -m foo -s /usr/sbin/nologin
    sudo passwd foo
    sudo nano /etc/shells #open this file
    Add "/usr/sbin/nologin" to /etc/shells
    #restart vsftpd
  9. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Setup FTP server (VSFTPD) on AWS EC2
    sudo apt-get update
    sudo apt-get install vsftpd
    ```
    # Update vsftp.config file
    ### Update vsftp.config file
    ```
    sudo nano /etc/vsftpd.conf
    #uncomment these settings
    @@ -26,7 +26,7 @@ sudo nano /etc/vsftpd.conf
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>
    ```
    # Create FTP User and allow login access to nologin shell. (By default, you can use port 21)
    ### Create FTP User and allow login access to nologin shell
    ```
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    @@ -35,11 +35,11 @@ Add "/usr/sbin/nologin" to /etc/shells
    #restart vsftpd
    sudo service vsftpd restart
    ```
    # Open ports in AWS EC2 instance security groups
    ### Open ports in AWS EC2 instance security groups
    ```
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
    sudo service vsftpd restart
    ```
    # Done!
    ### Done!
  10. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion configure-ftp.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Setup FTP server (VSFTPD) on AWS EC2
    ===============

    # Install vsftpd
    ### Install vsftpd
    ```
    sudo apt-get update
    sudo apt-get install vsftpd
  11. manojkumararyan renamed this gist Aug 23, 2018. 1 changed file with 3 additions and 0 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    Setup FTP server (VSFTPD) on AWS EC2
    ===============

    # Install vsftpd
    ```
    sudo apt-get update
  12. manojkumararyan renamed this gist Aug 23, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion abc.md → ...P server (VSFTPD) on Amazon EC2 ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -38,4 +38,5 @@ TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
    sudo service vsftpd restart
    ```
    ```
    # Done!
  13. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions abc.md
    Original file line number Diff line number Diff line change
    @@ -25,17 +25,17 @@ sudo nano /etc/vsftpd.conf
    ```
    # Create FTP User and allow login access to nologin shell. (By default, you can use port 21)
    ```
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    sudo nano /etc/shells #open this file
    Add "/usr/sbin/nologin" to /etc/shells
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    sudo nano /etc/shells #open this file
    Add "/usr/sbin/nologin" to /etc/shells
    #restart vsftpd
    sudo service vsftpd restart
    sudo service vsftpd restart
    ```
    # Open ports in AWS EC2 instance security groups
    ```
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
    sudo service vsftpd restart
    sudo service vsftpd restart
    ```
  14. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions abc.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,11 @@
    # Install vsftpd
    ```
    sudo apt-get update
    sudo apt-get install vsftpd
    ```
    # Update vsftp.config file
    ```
    sudo nano /etc/vsftpd.conf #open this file
    sudo nano /etc/vsftpd.conf
    #uncomment these settings
    write_enable=YES #for write access
    local_umask=022
    @@ -21,17 +23,17 @@ sudo nano /etc/vsftpd.conf #open this file
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>
    ```
    # Create FTP User and allow login access to nologin shell. (By default, you can use port 21)
    ```
    #Create FTP User and allow login access to nologin shell. (By defaylt, you can use port 21)
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    sudo nano /etc/shells #open this file
    Add "/usr/sbin/nologin" to /etc/shells
    #restart vsftpd
    sudo service vsftpd restart
    ```
    # Open ports in AWS EC2 instance security groups
    ```
    #open ports in aws ec2 security groups
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
  15. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions abc.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    sudo apt-get update
    ```
    sudo apt-get update
    sudo apt-get install vsftpd
    ```
    ```
    sudo nano /etc/vsftpd.conf #open this file
    #uncomment these settings
    write_enable=YES #for write access
    @@ -19,17 +20,20 @@ sudo nano /etc/vsftpd.conf #open this file
    #If you do not have a fixed IP address, then add these lines
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>

    ```
    ```
    #Create FTP User and allow login access to nologin shell. (By defaylt, you can use port 21)
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    sudo nano /etc/shells #open this file
    Add "/usr/sbin/nologin" to /etc/shells
    #restart vsftpd
    sudo service vsftpd restart

    ```
    ```
    #open ports in aws ec2 security groups
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
    sudo service vsftpd restart
    ```
  16. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion abc.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    sudo apt-get update
    `
    ```
    sudo apt-get install vsftpd
    ```
    sudo nano /etc/vsftpd.conf #open this file
    #uncomment these settings
    write_enable=YES #for write access
  17. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion abc.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    sudo apt-get update
    ```
    `
    sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf #open this file
    #uncomment these settings
  18. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion abc.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # sudo apt-get update
    sudo apt-get update
    ```
    sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf #open this file
    #uncomment these settings
  19. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions abc.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,4 @@
    Setup FTP server (VSFTPD) on Amazon EC2 ubuntu

    sudo apt-get update
    # sudo apt-get update
    sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf #open this file
    #uncomment these settings
  20. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions abc.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Setup FTP server (VSFTPD) on Amazon EC2 ubuntu

    sudo apt-get update
    sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf #open this file
  21. manojkumararyan revised this gist Aug 23, 2018. No changes.
  22. manojkumararyan renamed this gist Aug 23, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  23. manojkumararyan revised this gist Aug 23, 2018. 1 changed file with 25 additions and 21 deletions.
    46 changes: 25 additions & 21 deletions abc.rb
    Original file line number Diff line number Diff line change
    @@ -1,29 +1,33 @@
    sudo apt-get update
    sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf #uncomment these settings
    write_enable=YES #for write access
    local_umask=022
    chroot_local_user=YES #chroot_local_user is to restrict local user to their home directories. (/home/{user}/)
    sudo nano /etc/vsftpd.conf #open this file
    #uncomment these settings
    write_enable=YES #for write access
    local_umask=022
    chroot_local_user=YES #chroot_local_user is to restrict local user to their home directories. (/home/{user}/)
    #Add these lines at bottom of the file
    allow_writeable_chroot=YES
    pasv_enable=Yes
    pasv_min_port=1024
    pasv_max_port=1048
    port_enable=YES
    #If you use AWS EC2, you have a fixed public IP address, then add these lines
    pasv_addr_resolve=NO
    pasv_address=<SERVER_IP_ADDRESS>
    #If you do not have a fixed IP address, then add these lines
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>

    sudo useradd -m robin -s /usr/sbin/nologin #Create FTP User and allow login access to nologin shell. (By defaylt, you can use port 21)
    sudo passwd robin
    sudo nano /etc/shells
    Add "/usr/sbin/nologin" to /etc/shells
    allow_writeable_chroot=YES
    pasv_enable=Yes
    pasv_min_port=1024
    pasv_max_port=1048
    port_enable=YES
    #If you use AWS EC2, you have a fixed public IP address, then add these lines
    pasv_addr_resolve=NO
    pasv_address=<SERVER_IP_ADDRESS>
    #If you do not have a fixed IP address, then add these lines
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>

    #Create FTP User and allow login access to nologin shell. (By defaylt, you can use port 21)
    sudo useradd -m robin -s /usr/sbin/nologin
    sudo passwd robin
    sudo nano /etc/shells #open this file
    Add "/usr/sbin/nologin" to /etc/shells
    #restart vsftpd
    sudo service vsftpd restart

    Open ports in aws ec2 security groups
    #open ports in aws ec2 security groups
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    #again restart vsftpd
    sudo service vsftpd restart
  24. manojkumararyan created this gist Aug 23, 2018.
    29 changes: 29 additions & 0 deletions abc.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    sudo apt-get update
    sudo apt-get install vsftpd
    sudo nano /etc/vsftpd.conf #uncomment these settings
    write_enable=YES #for write access
    local_umask=022
    chroot_local_user=YES #chroot_local_user is to restrict local user to their home directories. (/home/{user}/)
    #Add these lines at bottom of the file
    allow_writeable_chroot=YES
    pasv_enable=Yes
    pasv_min_port=1024
    pasv_max_port=1048
    port_enable=YES
    #If you use AWS EC2, you have a fixed public IP address, then add these lines
    pasv_addr_resolve=NO
    pasv_address=<SERVER_IP_ADDRESS>
    #If you do not have a fixed IP address, then add these lines
    pasv_addr_resolve=YES
    pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>

    sudo useradd -m robin -s /usr/sbin/nologin #Create FTP User and allow login access to nologin shell. (By defaylt, you can use port 21)
    sudo passwd robin
    sudo nano /etc/shells
    Add "/usr/sbin/nologin" to /etc/shells
    sudo service vsftpd restart

    Open ports in aws ec2 security groups
    TCP 20 to 21
    TCP 1024 to 1048 #if enable passive mode
    sudo service vsftpd restart