LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Urgent!! File transfer from Windows to Linux server using ftp (https://www.linuxquestions.org/questions/linux-newbie-8/urgent-file-transfer-from-windows-to-linux-server-using-ftp-4175532637/)

g1234 01-31-2015 04:04 PM

Urgent!! File transfer from Windows to Linux server using ftp
 
Dear All

I need your help.
I want to get a file from windows server using ftp.
Below is the script I have created but the connection is not established:

#!/bin/sh

lcd "directory in linux server"
USER="username of windows server"
PASS="password"

ftp -n "ip of windows server" <<EOF
user $USER $PASS

cd "C:\Users... directory in windows server where file is located"
bin
get test1234.txt

bye

EOF

I hope somebody can help me!
BR,

JeremyBoden 01-31-2015 04:30 PM

Move the lcd command inside the ftp script as it is not a valid sh command.

g1234 01-31-2015 05:08 PM

Thank you for your reply!
I follow your suggestion but again I cannot connect.
Below is the error i get

ftp: connect: Connection timed out
Not connected.
Local directory now /home/omc/Script/test
Not connected.
Not connected.

btmiller 01-31-2015 10:24 PM

Have you verified that the FTP server is actually installed and working on the remote machine? Looks like the client cannot connect. Can it ping the server? Are all necessary ports operned (i.e. not firewalled).

veerain 02-01-2015 12:52 AM

Perhaps you need to give time for each ftp command.

Or better use a expect script.

You can also use ncftp to do batch upload of files.

g1234 02-01-2015 03:29 AM

Thank you for reply

I made a test to transfer the file from windows to linux server and i got this:
C:\Users\Admin>ftp -n "Linux server IP"
Connected to "Linux server IP".
220 (vsFTPd 2.0.5)
ftp> lcd C:\Users\Admin\Documents\test\
\Users\Admin\Documents\test\: F
ftp> user root "password"
530 Permission denied.
Login failed.
ftp>

It seems the there is a Firewall issue. I'm new in this stuff so could somebody help me?
I want to highlight that i'm interested to get the file from Linux server, not to use other ftp software.
Thank you in advance..

JeremyBoden 02-01-2015 07:30 AM

I'm not surprised.

ftp root access should never be allowed.
Do you want the world to have access to your Linux machine?
Try a different user.


All times are GMT -5. The time now is 08:06 AM.