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 :)
1 Answer
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.
-
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 ?– oguzhanMar 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.– laurentMar 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)– laurentMar 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.– oguzhanMar 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 ?– oguzhanMar 23, 2013 at 14:32
ssh
,ftp
,http
?