LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 03-05-2010, 05:25 AM   #1
Trailsmoke
LQ Newbie
 
Registered: Sep 2008
Posts: 7

Rep: Reputation: 0
ftp script fails when using -n flag


Hi!

I'm trying to set up a script on a Solaris 9 box to fetch files from a ftp.
Now I've ran in to a problem.

When using the -n flag I get disconnected. It works in other ftpscripts on the same local server connecting to other remote servers, but not this particular one.

When I from the command prompt manually run:

ftp ftp.remoteserver.com I get this.

Connected to ftp.remoteserver.com.
220 Security server forbids multiple PASV commands.
Name (ftp.remoteserver.com:myuser):

When entering the credentials it works fine.

But when running ftp -n ftp.remoteserver.com I only get this:

Connected to ftp.remoteserver.com.
220 Security server forbids multiple PASV commands.
421 Service not available, remote server has closed connection
ftp>

(Also, the -n flag seems to work when running from a windows box, so I guess to be some server setting in combination with some setting on the unix client that causes this, but I can't figure out what)

Please advice on whats wrong.

BR

Last edited by Trailsmoke; 03-05-2010 at 05:32 AM.
 
Old 03-05-2010, 08:56 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Just wondered what you were trying to achieve with the '-n' ?
 
Old 03-05-2010, 09:30 AM   #3
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Have you got a .netrc file in the script users home directory on the Solaris 9 box ?
Because that's where ftp looks for information.

Also, auto-login must be enabled on the remote ftp server.

man ftp

Why don't you put the user and pass in the script ?
(not that you should use ftp anyway, use scp or something)

Last edited by smoker; 03-05-2010 at 09:32 AM.
 
Old 03-06-2010, 03:59 AM   #4
Trailsmoke
LQ Newbie
 
Registered: Sep 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Just wondered what you were trying to achieve with the '-n' ?
Disable autologin.
 
Old 03-06-2010, 04:05 AM   #5
Trailsmoke
LQ Newbie
 
Registered: Sep 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smoker View Post
Have you got a .netrc file in the script users home directory on the Solaris 9 box ?
Because that's where ftp looks for information.

Also, auto-login must be enabled on the remote ftp server.

man ftp

Why don't you put the user and pass in the script ?
(not that you should use ftp anyway, use scp or something)
I think you misread the question.

I don't use autologin (that's what -n does.. disables autologin)hence I shouldn't need the .netrc, and it shouldn't matter of autologin is enabled/disabled on the remote server.

Well, I would also prefer scp, but sometimes it's easier to just use ftp.. for example in this case where the remote server is owned by another company and out of my control. Not even sure that it's a *nix server.

More ideas people.
 
Old 03-06-2010, 05:56 AM   #6
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
If you're not using auto login why use -n ?
How are you supposed to login without credentials ?

I misunderstood because you don't make sense.
 
Old 03-07-2010, 04:43 AM   #7
Trailsmoke
LQ Newbie
 
Registered: Sep 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Don't make sense?
You know it's quite common to use the -n flag when scripting ftp?

Of course I use credentials, the script looks something like this:

ftp -n $HOST <<"END_SCRIPT"
quote USER $USER
quote PASS $PASSWD
cd folder
get $FILE
bye
END_SCRIPT
 
Old 03-07-2010, 05:59 AM   #8
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
I've never used '-n' when scripting ftp connections....
 
Old 03-08-2010, 02:29 AM   #9
Trailsmoke
LQ Newbie
 
Registered: Sep 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
I've never used '-n' when scripting ftp connections....
Good for you!
Also, helpful post! Thank you! :S
 
  


Reply



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
What if a script inside another script fails to run? saiteju Programming 3 02-02-2010 11:35 PM
LXer: Red Flag Linux Olympic Edition fails to medal LXer Syndicated Linux News 0 09-12-2008 12:00 AM
ypbind init script -eq 100 flag thompsoa Linux - General 0 04-24-2008 11:58 AM
Urgent Help: Perl FTP Script Using NET::FTP xboxter Programming 8 05-16-2005 06:57 PM
How to add C-Flag to configure script merlin23 Linux - Newbie 1 01-13-2005 08:03 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

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

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
Open Source Consulting | Domain Registration