Recently, I started working on a CentOS server and got access via ssh. I have root privilege through ssh. How can I download a file from server into my PC and upload to another server through ssh?
Asked
Active
Viewed 2.3k times
1
2 Answers
4
Use scp command to upload a file:
scp [local-path] [username]@[hostname/ip]:[remote-path]
example:
scp /etc/example.file user@example.com:/etc/example
scp /etc/passwd user@10.0.0.1:/etc/passwd
To download a file:
1. You have a webserver installed on your server.
Place your file under website's root directory
example:
website:http://example.com
remote file location: /webroot/example.file
wget http://example.com/example.file
2. No webserver installed
scp [username]@[hostname/ip]:[remote-path] [localpath]
example:
scp user@example.com:/etc/passwd ./passwd
scp user@10.0.0.1:/etc/passwd ./passwd
IF you use iTerm2,it uses an awesome way to handle file upload/download through ssh client with a single right click: see here:iTerm2-shell-integration

FrontENG
- 273
-
Thanks you so much I used scp. scp root@example.com:[folder,path,etc..] ~/Downloads It's syntax download into folder Downloads in PC And easy to upload to another server. – Rei May 30 '17 at 03:36
0
scp
is what are you looking for.
Copy file from remote host (example.com) to ~/Downloads on your computer
scp root@example.com:/tmp/file ~/Downloads
.. and from your computer to a remote host (into home dir)
scp /tmp/file root@example.com:~/

stderr
- 986
rsync
has many advantages overscp
. – pfnuesel May 29 '17 at 12:22