Visit Our UNIX and Linux User Community


Shell Script to ftp from windows server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Script to ftp from windows server
# 1  
Old 11-06-2007
Shell Script to ftp from windows server

Hello All,

I've to write a shell script to transfer some files to/from windows server.

I can put & get files simply by doing ftp but need to automate this.

So I tried for this -.

HOST=.hostname
USER='username'
PASSWD='***'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
mput new*
quit

END_SCRIPT

as per search on this topic.

But I'm getting the error :

'AUTH GSSAPI': command not understood
'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
User ced-aswhec-ftp cannot log in.
mput new.sh? Please login with USER and PASS.
Passive mode refused. Turning off passive mode.
Please login with USER and PASS.
ftp: bind: Address already in use
mput newest.sh? Please login with USER and PASS.
mput newestt.sh? Please login with USER and PASS.



Does anyone have idea what exactly it mean? It's not accepting the valid username & password provided. Even let me know where the .netrc comes in picture...

Thanks in advance.



- Ships
# 2  
Old 11-06-2007
Put the user and password in your $HOME/.netrc file.

Code:
machine hostnameofmachine
login username
password passwordstring

Code:
chmod 0600 $HOME/.netrc

also, use "prompt" before using "mput" otherwise it may ask for confirmation.
# 3  
Old 11-06-2007
Thanks Porter, for the valuable suggestion. Got to know the concept n use of .netrc file.
But still i'm getting the same error. Is there anything that need to add to my script code for making the script to use the .netrc file or by default it looks into that only?

Regards,
Shilpa
# 4  
Old 11-06-2007
Quote:
Originally Posted by shilpa.rajput
Is there anything that need to add to my script code for making the script to use the .netrc file or by default it looks into that only?
do

Code:
ls -ld $HOME/.netrc

so we can see the permissions

post exactly what you are doing and results (we should now not see anything about username/password).

what system are you using? post result of "uname -a"
# 5  
Old 11-06-2007
Yeah, Porter,
The system I'm using is GNU/Linux

& the code now goes like :


Quote:
ftp -n hostname <<END_SCRIPT
prompt
mput new*
quit

END_SCRIPT
Now I'm having the hostname entry in .netrc file having permissions as

-rw------- i.e.as per the "chmod 0600 $HOME/.netrc" mentioned by u.

The result is as :

Code:
'AUTH GSSAPI': command not understood
'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
User ced-aswhec-ftp cannot log in.
Login failed.
Interactive mode off.
Please login with USER and PASS.
Passive mode refused.  Turning off passive mode.
Please login with USER and PASS.
ftp: bind: Address already in use

Even tried by using

Quote:
ftp -n 160.95.116.11 <<END_SCRIPT
user username passwordtring
prompt
mput new*
quit
END_SCRIPT


But came up with same result.

Thanks n Regards,
Shilpa
# 6  
Old 11-06-2007
You should just be able to do

Code:
ftp server-name

where server-name is exactly the same string as in $HOME/.netrc

Yes the attributes of $HOME/.netrc look right.

When it fails, is it printing the name of the user as read from $HOME/.netrc.

Don't use "-n", this disables the auto-login.
This User Gave Thanks to porter For This Post:
# 7  
Old 11-06-2007
Hi porter...

It works fine....is there a way where I can FTP without having to do anything on the .netrc file...In my case there was no .netrc file in my home directory so I created it.

thanks

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP using script not working (for transfering file from a remote unix server to windows PC.)

hi, Im using the following code for FTP #!/usr/bin/ksh ftp -v -n "10.29.45.11" << cmd user "mahesva" "mahesva123" get rtl.tar quit cmd Below is the log when i run the above code ********************************** Connected to 10.29.45.11. 220 (vsFTPd 2.0.1) 530 Please login with USER... (20 Replies)
Discussion started by: dll_fpga
20 Replies

2. Shell Programming and Scripting

FTP from windows to unix server using unix shell script

Hi, Is it possible to ftp a huge zip file from windows to unix server using unix shell scripting? If so what command i need to use. thanks in advance. (1 Reply)
Discussion started by: Shri123
1 Replies

3. Shell Programming and Scripting

Unix shell script to Copy files from one Windows server to another Windows server.

Can anybody please help me on how to code for the below requirement: I need to write a shell script (on different unix server) to copy files from multiple folders (ex. BRN-000001) from one windows server (\\boldls-mwe-dev4)to a different windows server(\\rrwin-ewhd04.ecomad.int). This shell... (4 Replies)
Discussion started by: SravsJaya
4 Replies

4. UNIX for Advanced & Expert Users

ftp in shell script from linux to windows XP

Hi, I have 9 different linux based servers and i am automating there healthcheckup by doing ssh and fetching deviations out of it in a single text file. I am doing so by using ssh keygen. I am done with the above part . Now i want to ftp that text file to my windows XP desktop and i want to... (4 Replies)
Discussion started by: gemnian.g
4 Replies

5. Shell Programming and Scripting

shell script to ftp the files from windows to unix server

Hi, I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine. Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files from windows to unix box.When I searched in the... (10 Replies)
Discussion started by: kavithakuttyk
10 Replies

6. UNIX for Advanced & Expert Users

Shell script to ftp files from windows to unix

Hi , I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files from windows to unix box.When I searched in the forum i... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

7. Shell Programming and Scripting

FTP from unix shell script to windows

Hi, I m trying to connect/establish FTP from unix shell script to my PC.Below the script i have written #!/bin/ksh ftp -v -n ddcappip01.com << "EOF" user Amit jason bye EOF ------------------------------ERROR-------------------------- but i m getting the below error for the... (4 Replies)
Discussion started by: ali560045
4 Replies

8. UNIX for Advanced & Expert Users

Executing shell script from Windows FTP

Hello, Any inputs on the possibility of executing a shell script on unix box from Windows FTP TIA (1 Reply)
Discussion started by: B2BIntegrator
1 Replies

9. Shell Programming and Scripting

FTP from Linux to windows server by shell script

Hi, Please advice whether my below requirement is feasible, My requirement : Automated FTP from linux server to windows server using a shell script on every monday. If feasible, please help me how to do this ? Thanks in advance (2 Replies)
Discussion started by: apsprabhu
2 Replies

10. Shell Programming and Scripting

how to move a file from one server to another server using FTP in shell script?

I have a file --> file1.txt i need to copy this file to another server using FTP....the 2 servers are server1 and server2..may i know how to write a script that can do this? thanks in advance! Im a newbie to this... (4 Replies)
Discussion started by: forevercalz
4 Replies

Featured Tech Videos