-1

I don't know how to remotely access to a virtual machine running a ubuntu server which has openssh server. Is there anyone can guide that if i want to access this virtual machine from anywhere, what should i do step by step ? Thanks :)

8
  • 1
    We can't answer this unless you give us a lot more information about your setup. What is the host OS? Is your LAN accessible from the internet? Is the virtual machine accessible from your LAN?
    – terdon
    Mar 23, 2013 at 13:28
  • my host os is ubuntu 12.10 and my lan is accessible from the internet, i set up virtual machine using NAT networking. Is there any info necessary ?
    – oguzhan
    Mar 23, 2013 at 13:47
  • How do you want to access the virtual machine? ssh, ftp, http?
    – terdon
    Mar 23, 2013 at 13:51
  • As i mentioned in question name, i think saying using openssh server means that i want to access by ssh.
    – oguzhan
    Mar 23, 2013 at 13:53
  • Yes, so it does. I guess I should have read the title, sorry :)
    – terdon
    Mar 23, 2013 at 13:56

1 Answer 1

1

This depends on how is your network configured, where is your remote server (same LAN, different LAN or internet for example) but I will try to give you the info related to ssh considering the network part is ok so you can ping your server from your machine. If this is not the case, you have 1st to figure out how to solve the networking problem before using ssh.

If your local machine is linux, you only need to issue:

ssh user@remote-machine

where user is the user you created on your remote server (if you just installed it and installed openssh-server without configuring it, this user will be allowed to ssh in the server).

and remote-machine is whatever you use to ping the machine (ip, hostname or url).

If your local machine is windows, install putty (putty site and configure user and remote-machine in the config.

Mainly if the remote machine is accessible from internet, this default config is not secure and you should configure /etc/ssh/ssd_config on your server to restrict password use, replacing with ssh keys at least. You can see how to configure ssh server better in ubuntu server help

EDIT:

Just saw in your comments your vm is behind NAT so to reach it you will need to forward port 22 to it on the router.

12
  • In advanced settings of vm, there is an option "port forwarding", i clicked, then appeared a table contain rows named Name, Protocol, Host IP, Host Port, Guest Ip and Guest Port respectively. It was automatically entered Rule 1 for Name row and TCP for Protocol row. What should i do ? Do you mean i should enter 22 for Guest Port row ?
    – oguzhan
    Mar 23, 2013 at 14:18
  • Not sure what virtual machine software you are using but I think entering port 22 should be at least part of the solution.
    – laurent
    Mar 23, 2013 at 14:22
  • Cannot edit previous comment anymore but this way, you will have to access your virtual machine using your vm host as remote-machine and it will do the port forward to the ssh server I think. To access from internet, you will also need to configure your external router to send port 22 to the virtual machine host (if it is not the same machine)
    – laurent
    Mar 23, 2013 at 14:26
  • I am using Oracle VM VirtualBox. Inside same computer, there is a host os (ubuntu) and a virtual machine running ubuntu server.
    – oguzhan
    Mar 23, 2013 at 14:29
  • I left same name and protocol rows and wrote my ip for Host IP, 8080 for Host Port, ip of server for Guest Ip and 22 for Guest Port. Then from a different machine, i wrote username@ipofserver but it returned an error "No route to Host". What should i do ?
    – oguzhan
    Mar 23, 2013 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .