The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to execute script from my desktop windows xp to my HPUX server? kenshinhimura HP-UX 2 03-05-2008 05:47 PM
Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server madhunk UNIX for Dummies Questions & Answers 5 01-31-2008 01:30 PM
how to move a file from one server to another server using FTP in shell script? forevercalz Shell Programming and Scripting 4 10-27-2005 01:53 AM
If a is windows gui ( client), b is a unix gui ( Server for a) and c is a shell scrip hchivukula UNIX for Dummies Questions & Answers 1 06-12-2005 08:34 AM
How to execute a shell script from Windows kyawlin UNIX for Dummies Questions & Answers 4 12-19-2003 09:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-06-2007
shilpa.rajput shilpa.rajput is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 5
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 (permalink)  
Old 11-06-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
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 (permalink)  
Old 11-06-2007
shilpa.rajput shilpa.rajput is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 5
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 (permalink)  
Old 11-06-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by shilpa.rajput View Post
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 (permalink)  
Old 11-06-2007
shilpa.rajput shilpa.rajput is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 5
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 (permalink)  
Old 11-06-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
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.
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0