1752798 Members
6137 Online
108789 Solutions
New Discussion юеВ

ftp login

 
SOLVED
Go to solution
Ralf Buchhold
Regular Advisor

ftp login

Hello
i must ftp an file from a sun machine.
Is it possible for am automatic ftp (get and put) ? I have the username and password for the ftp sun user ?
Thanks
Ralf
6 REPLIES 6
Alex Lavrov.
Honored Contributor
Solution

Re: ftp login

Yes. You should use .netrc file. It's not secure solution, but it does what you want.

http://www.users.qwest.net/~eballen1/scripting.ftp.html

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Balasubramanian S
Frequent Advisor

Re: ftp login

Hello Ralf, I believe you can do that. You need to add the following in .netrc file,
machine host_1 login usr_name password passwd.

< Bala S
Muthukumar_5
Honored Contributor

Re: ftp login

You can also use scripting to do it effectively as,


ftp -n -i <<-EOF
user
cd location
lcd local-location
get file
put file
bye
EOF

Put this file into a script and automate with cron schedular also.

hth.
Easy to suggest when don't know about the problem!
Bejoy C Alias
Respected Contributor

Re: ftp login

U can do this way also.
create a file like this

user username passwd

quit

Then execute ftp as 'ftp -in host < filename'
Be Always Joy ......
generic_1
Respected Contributor

Re: ftp login

Consider seting up scp with keys. This would be secure and easy.
Thomas Moersch
Occasional Advisor

Re: ftp login

Yes, Ralf, scp is the way to go. It is way easier to script, plus you have the option of checking the return code "$?" after each scp. This will allow you to make your script a lot smarter.

scp local.filename userid@remotehost:/path/and/filename

Thomas