1834226 Members
2408 Online
110066 Solutions
New Discussion

using sftp

 
SOLVED
Go to solution
Marco Camacho_1
Frequent Advisor

using sftp

Hi folks!
I need to transfer some files using sftp protocol in automated way, can anybody share a little script to do that?
I´ll appreciate your help.
Mark-ito
5 REPLIES 5
Alessandro Pilati
Esteemed Contributor
Hakan Aribas
Valued Contributor

Re: using sftp

Hi,

You can scp instead of sftp. scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. Unlike rcp, scp will ask for passwords or passphrases if they are needed for authentication.

Usage:
scp file username@hostname:file
scp username@hostname:file file
Donny Jekels
Respected Contributor

Re: using sftp

Marco,

best way to implement this is the follwoing.

server a:
say you are user pusher
1) ssh-keygen -t rsa

# accept all defaults fro the prompts that follow

2) cat .ssh/id_rsa.pub | ssh serverb "( cat - >> .ssh/authorized_keys2 )"
enter yourpassword for the id on serverb

3) ssh serverb "uname -a"
your shoudl see the remote server name without entering a password.

viola:

4) scp ~/*.bkp serverb:/mybackupdir/.

or

4) rsync --rsh=ssh ~/*.bkp serverb:/mybackupdir/

peace, and enjoy the power of ssh
"Vision, is the art of seeing the invisible"
Marco Camacho_1
Frequent Advisor

Re: using sftp

thanks everybody for your help, i have many options to probe.! Regards.
Mark-ito
Marco Camacho_1
Frequent Advisor

Re: using sftp

thanks for your time and help!

Mark-ito