Reputation: 3
I want to write a shell script which copy the file from another server to my box using SFTP without prompting for a password as I have already made private keygen for password on server. Can you provide me the example script to do it.
Upvotes: 0
Views: 4289
Reputation: 60516
You can use scp
which works on ssh
protocol and read private keys as well:
scp -r path/to/src/folder1 username@server:/path/to/dst/folder
The -r
switch is to copy recursively
If you need to specify port, use -p
scp -r -P 2222 path/to/src/folder1 username@server:/path/to/dst/folder
Upvotes: 1