DEV Community

Cover image for Easy way to SSH into VirtualBox machine | Any OS

Easy way to SSH into VirtualBox machine | Any OS

Tharun Shiv on July 12, 2020

Hey there! This is Tharun here. Most of us would have struggled to SSH into a VirtualBox Machine. In this article, I introduce to you what Virt...
Collapse
 
redcricket profile image
redcricket • • Edited

% ssh -p 3022 127.0.0.1
kex_exchange_identification: Connection closed by remote host
Connection closed by 127.0.0.1 port 3022

trying to ssh to ubuntu vm

Ah. I didn't install openssh-server on the ubuntu vm like so ...
sudo apt-get install openssh-server

Collapse
 
justman10000 profile image
Justman10000 •

Yes, it's nasty! You want to use software and forget to install it!

Collapse
 
longtth profile image
Long Nguyễn Xuân •

thanks for comment this.

Collapse
 
nandum21 profile image
nandum21 •

try:
ssh -p 3022 username@127.0.0.1
can change port to 7777 like that .... as ur wish

Collapse
 
balukrish111 profile image
balu •

Thanks a lot man :)

Collapse
 
developertharun profile image
Tharun Shiv •

Glad it helped. :)

Collapse
 
igormarques profile image
igor-marques •

had trouble using

$ ssh -p 3022 imarques@127.0.0.1
Connecting to 127.0.0.1:22...
Could not connect to '127.0.0.1' (port 22): Connection failed.

changed to

$ ssh imarques@127.0.0.1:3022
Connecting to 127.0.0.1:3022...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-84-generic x86_64)

many thanks!

Collapse
 
developertharun profile image
Tharun Shiv •

Awesome!

Collapse
 
vi_thali profile image
Vitaly Natalievich •

Thanx a lot!

Collapse
 
kaizen profile image
Thanh Nguyen •

awesome bro. it saved me :D

Collapse
 
nandum21 profile image
nandum21 •

This Works ... Thanks :)

Collapse
 
justman10000 profile image
Justman10000 •

Spent hours looking for this, thanks to this post it finally works...

Collapse
 
phylloxera profile image
Phylloxera •

Operation timed out