ssh remote copy?

Associate
Joined
21 Oct 2008
Posts
1,679
Location
Mooching... in your house
been playing with ssh and trying to get my head around something...

so i've logged in:

ssh username@ip,address

and i've navigated to a folder which contains a file i want...

how do i get it? i can see it there when i do an ls command, but i want to download it to the machine i'm on...

i've read about scp but that seems to be an all in one command where you need to use the ip address and login details again but surely once you are already logged in like in my above example, theres an easier way?
 
Either ssh into the remote machine and do an scp from there ( "scp file username@yourpcipaddress:/wheretocopyitto" ) or easier is just to open a terminal on your pc and do "scp username@remoteip:/pathtofile localpathtocopyto"
 
As above, you can also use sftp which is essentially ftp over ssh. (doesn't require anything additional enabled on the server)

Code:
sftp [email protected]
cd mydir
get myfile
put myfile

Are you sure it doesn't need anything done on the server? I can connect via SSH, but using sftp in a terminal, and using filezilla I get rejected? Does it need enabling in ssh_config? cos i would love to get sftp workin but i have to use standard ftp with vsftp.

thanks.
 
Are you sure it doesn't need anything done on the server? I can connect via SSH, but using sftp in a terminal, and using filezilla I get rejected? Does it need enabling in ssh_config? cos i would love to get sftp workin but i have to use standard ftp with vsftp.

thanks.

hmm on most major distros it's enabled by default these days.

Worst case, add "Subsystem sftp /usr/lib/ssh/sftp-server" to /etc/ssh/sshd_config and restart sshd (or your specific path to the binary) and it should work.
 
nono i understand the syntax for scp guys, what im asking is whether there is a way to copy from a server that you are already logged into without using the login details again if that makes sense...

logged in, navigated to the folder where the file is, now youre saying i have to use an scp command and include the user@server stuff again? despite the fact that i'm already in?

am i missing something here? i quite possibly am but using scp once logged in seems a bit, backward?
 
nono i understand the syntax for scp guys, what im asking is whether there is a way to copy from a server that you are already logged into without using the login details again if that makes sense...

logged in, navigated to the folder where the file is, now youre saying i have to use an scp command and include the user@server stuff again? despite the fact that i'm already in?

am i missing something here? i quite possibly am but using scp once logged in seems a bit, backward?

im 90% sure that isn't possible. SSH itself doesn't provide file copy functionality, instead you have to use a subsystem like scp or sftp, both of these as far as im aware require the opening of a new session by providing the user@server... Might be wrong though.
 
If you login to a server then scp from it, you are authenticating with your machine, not the server (I.e. You are authenticating with the machine which is remote from the machine performing the scp command) :)
 
What if he's using a Mac?

*vomit*
I have it on good authority that you cry yourself to sleep each night cuz you don't have a mac.

when i started this thread i hadn't really got my head around some of the basic concepts of ssh, its all a lot clearer now ;)
 
What if he's using a Mac?

*vomit*

if possible.... I would think the mac has a graphical SSH/SFTP client somewhere though... Does the mac have a FUSE like layer? It's pretty decent to be able to just 'mount' a SH connection or and FTP connection in gnome/KDE it has to be said.
 
Back
Top Bottom