maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Off Topic (https://talk.maemo.org/forumdisplay.php?f=19)
-   -   help on transferring files via ssh (https://talk.maemo.org/showthread.php?t=46207)

debernardis 2010-03-01 16:12

help on transferring files via ssh
 
I'm asking your help for doing one thing with my n900 and my home server.

I originate a ssh connection from my n900 to my home server, and execute on the server a terminal application. The application writes one file in a directory on the server.
I would like to be able to transfer that file from the server to my n900 on the same ssh session, i.e the one that is originated from the n900.

I thought of using scp, but as far as I know it means that from the server I should ssh back to the n900 like that: scp user@n900.ip.address:file/path/on/server file/path/on/n900
but it's not what I want, because I should know also the ip address of the n900.

Ideally, I would add the transfer command to my server application so that the file is automatically transferred to my n900 when the program quits.

Is it feasible? How can I do that? Thanks :)

cddiede 2010-03-01 16:25

Re: help on transferring files via ssh
 
Quote:

Originally Posted by debernardis (Post 551150)
I'm asking your help for doing one thing with my n900 and my home server.


I thought of using scp, but as far as I know it means that from the server I should ssh back to the n900 like that: scp user@n900.ip.address:file/path/on/server file/path/on/n900 but it's not what I want, because I should know also the ip address of the n900.

So you want to scp a file from the server that you've SSH'd into back to the N900, right?

Sounds like you've got it right. Just execute:

scp <target file name> user@<n900's IP address>:/path/to/target/directory

What's the problem with doing it like this?

You said: "but it's not what I want, because I should know also the ip address of the n900."

I don't really understand this statement. Are you having a problem because you DON'T know the N900's IP address?

I think this might be a language barrier problem because I can't really understand what you are trying to say.

Rob1n 2010-03-01 16:32

Re: help on transferring files via ssh
 
Quote:

Originally Posted by debernardis (Post 551150)
I'm asking your help for doing one thing with my n900 and my home server.

I originate a ssh connection from my n900 to my home server, and execute on the server a terminal application. The application writes one file in a directory on the server.
I would like to be able to transfer that file from the server to my n900 on the same ssh session, i.e the one that is originated from the n900.

I thought of using scp, but as far as I know it means that from the server I should ssh back to the n900 like that: scp user@n900.ip.address:file/path/on/server file/path/on/n900
but it's not what I want, because I should know also the ip address of the n900.

Ideally, I would add the transfer command to my server application so that the file is automatically transferred to my n900 when the program quits.

Is it feasible? How can I do that? Thanks :)

The IP address should be pretty easy to get (via the SSH_CLIENT environment variable). The alternative would be to use remote tunneling along with another protocol (or just a simple client/server app).

Elhana 2010-03-01 17:01

Re: help on transferring files via ssh
 
I assume N900 might be behind proxy or NAT, nevertheless scp just need source and target, here is back and forth:
scp user@server:file/path/on/server /file/path/on/n900
scp /file/path/on/n900 user@server:file/path/on/server

p.s. tunneling.... some people really make it look like a rocket science, google for "man scp" maybe? ))

debernardis 2010-03-01 18:08

Re: help on transferring files via ssh
 
Thanks people, even if English is not my mother tongue, you grasped it right. Putting it simply, I didn't know of the existence of the SSH_CLIENT environment var. This makes the thing quite simpler :)


All times are GMT. The time now is 01:58.

vBulletin® Version 3.8.8