How to transfer and received file beagle bone to FTP server in fedora

 How to transfer and received file beagle bone to FTP server in        fedora

Server Side:

Step 1:In vsftpd.conf file (/etc/vsftpd/vsftpd.conf) editthis lines.

 anon_other_write_enable=YES
dirmessage_enable=YES
dirlist_enable=YES
no_anon_password=YES
file_open_mode=0777
guest_enable=YES
anon_upload_enable=YES


Step 2 : start service vsftpd (service vsftpd start)
Step 3: stop firewall (systemctl stop firewalld.service)
step 4: mount --bind /default directory/ /var/ftp

Client side: 

Step 1: stop firewall service

from ftplib import FTP

import os



flag = True



while(flag):

        os.system("ifconfig eth0 192.168.5.2")

        ftps = FTP('172.16.1.176')

        ftps.login('apcoer','12345678')



        print "Select an option for transfering files:\n1.Machine to BBB\n2. BBB to machine"

        print "3.FTP to BBB\n4.BBB to FTP\n5.Exit"

        choice = int(input())

        if choice == 1:

                mcip = raw_input("Enter the ip of machine from where the file is to be received: ")



                user = raw_input("Enter the user from  whom the file is to be received: ")

                filename = raw_input("Enter path of the file to be received: ")

                destpath = raw_input("Enter the path where the file is to be stored: ")

                os.system("scp "+user+"@"+mcip+":"+filename+" "+destpath)

                print "File received successfully"





        elif choice == 2:

                mcip = raw_input("Enter the ip of machine to send files to: ")

                user = raw_input("Enter the user to whom the file is to be sent: ")

                destpath = raw_input("Enter where the file should be stored on receiving machine: ")

                filename = raw_input("Enter the path to the file to be sent: ")

                os.system("scp "+filename+" "+user+"@"+mcip+":"+destpath)

                print "File successfully sent"



        elif choice == 3:

             ftps.retrlines('LIST')

                filename = raw_input("Enter the filename to be downloaded: ")

                ftps.retrlines('RETR '+filename, open(filename,"wb").write)

                print "File successfully downloaded"



        elif choice == 4:

                filename = raw_input("Enter the filename which is to be sent: ")
        print filename
                #ftps.storlines("STOR " + os.path.basename(filename), open(filename))
        ftps.storlines('STOR '+os.path.basename(filename), open(os.path.basename(filename),w"/var/ftp"))

                print "File successfully uploaded"



        else:

                flag = False

Comments

  1. I am looking forward to read more blog post regarding this! Well written!http://awriter.org/rushessaycom/

    ReplyDelete

Post a Comment

Popular posts from this blog

NASM: program to find largest number from an array of 32-bit numbers(hard-coded)

Rules for drawing a FLOWCHART