Home How to download a file from server using SSH?
Reply: 4

How to download a file from server using SSH?

NiLL
1#
NiLL Published in 2012-02-24 08:25:28Z

I need to download a file from server to my desktop. (UBUNTU 10.04) I don't have a web access to the server, just ssh.

If it helps, my OS is Mac OS X and iTerm 2 as a terminal.

Marek Grzenkowicz
2#
Marek Grzenkowicz Reply to 2015-03-14 09:31:07Z

In your terminal, type:

scp your_username@remotehost.edu:foobar.txt /local/dir

replacing the username, host, remote filename, and local directory as appropriate.

If you want to access EC2 (or other service that requires authenticating with a private key), use the -i option:

scp -i key_file.pem your_username@remotehost.edu:/remote/dir/foobar.txt /local/dir

From: http://www.hypexr.org/linux_scp_help.php

J-16 SDiZ
3#
J-16 SDiZ Reply to 2012-02-24 08:28:03Z

If the SSH server support SFTP subsystem (this is part of SSH, and unrelated to FTP), use sftp. If it don't, try scp.

CyberDuck support all of them.

Sphinxxx
4#
Sphinxxx Reply to 2018-01-23 01:42:02Z

You can do this with the scp command. scp uses the SSH protocol to copy files across system by extending the syntax of cp.

Copy something from another system to this system:

scp username@hostname:/path/to/remote/file /path/to/local/file

Copy something from this system to some other system:

scp /path/to/local/file username@hostname:/path/to/remote/file          

Copy something from some system to some other system:

scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file   
William Pursell
5#
William Pursell Reply to 2015-07-14 17:31:47Z

scp is certainly the way to go, but for completeness you can also do:

$ ssh host 'cat /path/on/remote' > /path/on/local

or

$ cat /path/on/local | ssh host 'cat > /path/on/remote'

Note, this is UUOC, but < /path/on/local ssh host 'cat > /path' could cause unnecessary confusion.

And to proxy between two hosts:

$ ssh host1 'cat /path/on/host1' | ssh host2 'cat > /path/on/host2'
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.321259 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO