LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   sftp automation for downloading files (https://www.linuxquestions.org/questions/linux-security-4/sftp-automation-for-downloading-files-204819/)

chipix 07-14-2004 03:53 AM

sftp automation for downloading files
 
Hi,

I want to use sftp in order to download some files from a remote server. My case is the following:

1. username: user123
2. pass: pass123
3. remote server: ftp.myserver.com

The commands I want to send after the connection are:
1. bin
2. cd mydir
3. get myfile

I want to write a script to automate this procedure using cron.

Any help regarding the sftp command line abilities would be appreciated.

Thanks
:)

ppuru 07-14-2004 04:52 AM

consider using scp.

e.g. scp user@remotehost:/mydir/filename .

with the use of publickeys, you can avoid keying in passwords.

chipix 07-14-2004 05:29 AM

thanks for your reply.

I did not know how to use the public key, however this site http://bumblebee.lcs.mit.edu/ssh2/ was very helpful.

:D

chipix 07-14-2004 05:30 AM

Another question.

if my connection is broken do u know if my copy can be resumed?

Kess78 07-14-2004 05:55 AM

Hi,
1st method:
you can run ftp with an automated script command execution after connection..
ftp -s:"<your_script.txt>" ftp.myserver.com

The content of your_script.txt could simply be:

user123
pass123
bin
cd mydir
get myfile
by

2nt method:
type in command line the following:
ftp ftp://user123:pass123@ftp.myserver.com:21/mydir/myfile

Hope this helps, bye Kess

Kess78 07-14-2004 05:57 AM

Sorry, The smile is a :p

Bye..


All times are GMT -5. The time now is 09:03 PM.