LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 06-11-2009, 08:24 AM   #1
just a man
Member
 
Registered: Feb 2009
Posts: 37

Rep: Reputation: 15
FTP command in a script


I want to use the ftp command to push stuff to a remote server in a script.

How do I supply the username and password so the remote doesn't prompt for them?

On a related note, generaly how do you make a bash script respond to prompts?

EG:

> script connects to something
<something asks for password
>script provides password
<something accepts password
>script asks user for option
<user chooses option "A"

etc.
 
Old 06-11-2009, 08:27 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
Take a look at ftpput
 
Old 06-11-2009, 08:33 AM   #3
just a man
Member
 
Registered: Feb 2009
Posts: 37

Original Poster
Rep: Reputation: 15
Code:
$ ftpput --server=ftp.unixwiz.net --verbose --user=steve --pass=yahright file1 file2
--> put file1
    (sent OK)
--> put file2
    (sent OK)
Thanks for that, unfortunately my Gentoo based system tells me

Code:
there are no ebuilds to satisfy "ftpput".
Might there be another version of this or something, or maybe a flag with the ftp command does the same thing the same way?
 
Old 06-11-2009, 08:40 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Code:
ftp -ni ftp.server << EOF
  user username password
  binary
  put file1
  put file2
  bye
EOF
 
Old 06-11-2009, 08:45 AM   #5
nuwen52
Member
 
Registered: Feb 2009
Distribution: Debian, CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 208

Rep: Reputation: 46
In gentoo, there are ebuilds for ncftp. And ncftp has a put function that works similar to ftpput. I think the program inside the build is ncftpput.

Last edited by nuwen52; 06-11-2009 at 08:47 AM.
 
Old 06-11-2009, 10:41 AM   #6
pg99
Member
 
Registered: May 2008
Location: UK
Distribution: Slackware
Posts: 73

Rep: Reputation: 18
Isn't that what the .netrc file is for?
 
Old 06-11-2009, 01:00 PM   #7
just a man
Member
 
Registered: Feb 2009
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nuwen52 View Post
In gentoo, there are ebuilds for ncftp. And ncftp has a put function that works similar to ftpput. I think the program inside the build is ncftpput.
Thanks, works great.
 
  


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 / Command line ftp quesion 200mg Linux - Server 4 05-06-2008 04:21 PM
FTP Command Line (Scripting Multiple FTP gets) Critcho Linux - Software 3 01-05-2007 12:57 AM
what is different with Ftp From browser and Ftp from command line zahra79 Linux - Networking 2 06-22-2005 04:26 AM
Urgent Help: Perl FTP Script Using NET::FTP xboxter Programming 8 05-16-2005 07:57 PM
using ftp to download whole folder -- script or command ? hq4ever Linux - Networking 7 10-22-2004 12:41 PM


All times are GMT -5. The time now is 02:59 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