LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-14-2004, 03:53 AM   #1
chipix
LQ Newbie
 
Registered: Dec 2002
Location: Athens, HELLAS
Distribution: Fedora Core 4
Posts: 22

Rep: Reputation: 15
Lightbulb 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
 
Old 07-14-2004, 04:52 AM   #2
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
consider using scp.

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

with the use of publickeys, you can avoid keying in passwords.
 
Old 07-14-2004, 05:29 AM   #3
chipix
LQ Newbie
 
Registered: Dec 2002
Location: Athens, HELLAS
Distribution: Fedora Core 4
Posts: 22

Original Poster
Rep: Reputation: 15
Talking

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.

 
Old 07-14-2004, 05:30 AM   #4
chipix
LQ Newbie
 
Registered: Dec 2002
Location: Athens, HELLAS
Distribution: Fedora Core 4
Posts: 22

Original Poster
Rep: Reputation: 15
Another question.

if my connection is broken do u know if my copy can be resumed?
 
Old 07-14-2004, 05:55 AM   #5
Kess78
Member
 
Registered: Jul 2004
Location: Switzerland
Distribution: Debi@n, SuSE
Posts: 36

Rep: Reputation: 15
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://user123ass123@ftp.myserver.com:21/mydir/myfile

Hope this helps, bye Kess
 
Old 07-14-2004, 05:57 AM   #6
Kess78
Member
 
Registered: Jul 2004
Location: Switzerland
Distribution: Debi@n, SuSE
Posts: 36

Rep: Reputation: 15
Sorry, The smile is a :p

Bye..
 
  


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
sftp chroot jail, not able to find lib files drolic Linux - Security 3 11-23-2005 11:57 AM
scp/sftp over lan slow/stalled with larger files m29389 Linux - Networking 2 06-24-2004 04:03 AM
how to grab multiple files at the same time in SFTP? HiOctane21 Programming 1 05-02-2004 01:32 AM
Files truncated by sftp/sftp-server at 65kb gato Linux - Networking 1 12-18-2003 10:29 AM
sftp users can remove files without permission tunedLow Linux - Networking 6 03-06-2003 03:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:20 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
Open Source Consulting | Domain Registration