LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2015, 05:04 PM   #1
g1234
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Rep: Reputation: Disabled
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,
 
Old 01-31-2015, 05:30 PM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,022

Rep: Reputation: 203Reputation: 203Reputation: 203
Move the lcd command inside the ftp script as it is not a valid sh command.

Last edited by JeremyBoden; 01-31-2015 at 05:31 PM.
 
Old 01-31-2015, 06:08 PM   #3
g1234
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-31-2015, 11:24 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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).
 
Old 02-01-2015, 01:52 AM   #5
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
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.
 
Old 02-01-2015, 04:29 AM   #6
g1234
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
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..
 
Old 02-01-2015, 08:30 AM   #7
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,022

Rep: Reputation: 203Reputation: 203Reputation: 203
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP file transfer and confirmation --- URGENT Vthimmap Linux - Newbie 2 08-21-2014 03:41 AM
ftp server -- file transfer access problem pallavibsh Linux - Server 3 05-11-2012 01:18 PM
file transfer program in c using FTP client and FTP server renuaseri Linux - Newbie 2 01-29-2011 06:49 AM
file transfer from one ftp server to another ftp server divyashree Linux - Newbie 7 02-24-2010 03:48 AM


All times are GMT -5. The time now is 08:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration