LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2011, 06:43 PM   #1
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Rep: Reputation: Disabled
How can I ssh/scp into a remote's machine local machine?


I want the address format of that. Allow me to explain:

I am in location A;
A server is in location B;
The server runs linux and has an active virtual machine on it (also running linux).
I know the address of the server (server.address.com) and I know the local ip (192.168.0.1) address of the virtual machine.

I have winscp and I want to access the virtual machine on that remote server directly so I'll download a file off of it on my pc in location A.(note that the internet connection is not a problem)

username on remote server= gauss
username on virtual machine= root (with uid=0)

Please give me a concrete example of code. I want to access the virtual machine directly on winscp, not access the server, and run some commands. I just don't know the address format.

Note that any data given (no matter of what kind it appears to be) is for example purposes only. Any reference to external sources is purely unintentional. In other words, my server is not hosted on address.com and the username is not really gauss. However, I do have root privileges on the virtual machine.

Last edited by venom4u31; 11-04-2011 at 06:50 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-04-2011, 07:08 PM   #2
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
I don't think you can login to this virtual machine directly because the virtual machine's address is on the 192.168.*.* subnet which is always considered a local subnet -- it's one of those weird realms of the IP universe reserved for local machines only so it means a different machine for more or less everyone in the entire world.

You might be able to set up some kind of proxy or packet forwarding type thing on the Server in location B, but you are going to have to talk to Server B first and have it act as a go-between for you. There might also be some way to have the virtual machine bound to a different IP address -- i.e., one that is meaningful to the internet at large.
 
Old 11-04-2011, 07:10 PM   #3
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sneakyimp View Post
I don't think you can login to this virtual machine directly because the virtual machine's address is on the 192.168.*.* subnet which is always considered a local subnet -- it's one of those weird realms of the IP universe reserved for local machines only so it means a different machine for more or less everyone in the entire world.

You might be able to set up some kind of proxy or packet forwarding type thing on the Server in location B, but you are going to have to talk to Server B first and have it act as a go-between for you. There might also be some way to have the virtual machine bound to a different IP address -- i.e., one that is meaningful to the internet at large.
Alright, and if that virtual machine has the ip address (for example) 10.23.6.1, how will I connect to it in the circumstances shown above?

Last edited by venom4u31; 11-04-2011 at 07:22 PM.
 
Old 11-04-2011, 07:35 PM   #4
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
You haven't specified what kind of connection you need. There's also the question of what kind of connections a linux machine supports. There's also the question of what user credentials you have for the various machines. I often connect using SSH from my windows machine to an Ubuntu linux machine on my LAN using PuTTY and then from the command line, I connect to a remote machine like so:
Code:
ssh username@10.23.6.1
and am prompted for a password...

...UNLESS of course the remote machine has SSHD configured to permit only certificate-based logins, etc.

But in order to transfer files from machine to machine you might have to use the scp command. You might do something like this:
1) Login to 10.23.6.1 using ssh from a mac or *nix machine OR using puTTY from a windows machine
2) use scp command from that linux machine to copy a file from the virtual machine (192.168.0.1) to the linux machine.
3) logout from the linux machine and then use scp from your local mac or *nix machine OR pscp from your windows machine to copy the file locally.
 
1 members found this post helpful.
Old 11-04-2011, 10:25 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I assume your remote server and the VM on it share the same subnet.

Then you can build an SSH tunnel. Assume winscp uses port 2200. Open a terminal and build the tunnel:
ssh -L 8000:192.168.0.1:2200 remote.server.com

What did you do? As soon as you logged in on remote.server.com, you built a tunnel which translates port 8000 on you local host to port 2200 on 192.168.0.1 on the other side (B).

So in order to use winscp, (no idea what it is)
winscp localhost:8000

That is right, localhost:8000 gets translated to 192.168.0.1:2200

jlinkels
 
2 members found this post helpful.
Old 11-05-2011, 04:17 AM   #6
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlinkels View Post
I assume your remote server and the VM on it share the same subnet.

Then you can build an SSH tunnel. Assume winscp uses port 2200. Open a terminal and build the tunnel:
ssh -L 8000:192.168.0.1:2200 remote.server.com

What did you do? As soon as you logged in on remote.server.com, you built a tunnel which translates port 8000 on you local host to port 2200 on 192.168.0.1 on the other side (B).

So in order to use winscp, (no idea what it is)
winscp localhost:8000

That is right, localhost:8000 gets translated to 192.168.0.1:2200

jlinkels
So tunneling might be my answer, so I can use the physical machine as a proxy to the virtual machine on it.

By the way, winscp is a file manager on windows where you can easily download files through ssh (that's why it's called winscp). It provides a graphical interface which can be slightly better than using the terminal.

L.E. I used tunneling and it worked like a charm... Thanks for the information

Last edited by venom4u31; 11-05-2011 at 04:36 AM.
 
Old 11-05-2011, 01:36 PM   #7
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
Nice!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mounting samba filesystem on remote machine as /home on local machine shishirkotkar Linux - Software 1 04-28-2008 05:05 AM
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 12:23 PM
Complicated one: MySQL, rsync, remote machine, local machine daiver Linux - General 2 02-27-2006 12:14 PM
how to open a dilog on local machine when i do ssh to remote machine fahad26 Programming 3 05-03-2005 07:39 PM
How do I setup xwindow to run a remote desktop on my local machine through ssh. green-ears Linux - Newbie 4 11-04-2003 05:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration