Hi,
In this blog, we'll learn how to copy a remote server file using scp to another server/local system.
Requirments:
* You should have installed 'OpenSSH-server' on the target machine.
* machine should be on the same network
Steps:
-> To copy a single file ( let say '/home/sysAdmin/xyz.log' to target machine's home location with ip and user are '192.168.0.26' (in case of VPN network it'll be machine's VPN ip) and 'max' respectively)
[ when it's not required to specify credential file. ]
$ scp /home/sysAdmin/xyz.log [email protected]:~/
[ when it's not required to specify credential file. ]
$ scp -i <credential/pem_file> /home/sysAdmin/xyz.log [email protected]:~/
-> Now to copy an entire directory ( let say directory : /home/sysAdmin/tempDir )
[ when it's not required to specify credential file. ]
$ scp -r /home/sysAdmin/tempDir [email protected]:~/
[ when it's not required to specify credential file. ]
$ scp -i <credential/pem_file> -r /home/sysAdmin/tempDir [email protected]:~/
In the above steps, may be you'll be asked for target machine's password, please provide that.
That's all. I hope, this will be useful in some way.
Thanks.
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Mohit Shakya
Mohit has worked in groovy and grails, filesystems, ffmpeg. Mohit likes to be adventurous, likes music, solving puzzles, playing chess, and basketball.