Skip to content

Instantly share code, notes, and snippets.

@DemianD
Last active March 10, 2018 13:33
Show Gist options
  • Save DemianD/efd427782d6240c41a23f1cf452793a8 to your computer and use it in GitHub Desktop.
Save DemianD/efd427782d6240c41a23f1cf452793a8 to your computer and use it in GitHub Desktop.
VirtualBox: enable SSH

VirtualBox: Set up SSH

Configuration

sudo systemctl enable sshd
sudo systemctl start sshd

sudo systemctl set-default multi-user.target

wget -O ~/.bashrc https://gist.githubusercontent.com/DemianD/13c2ffedbf20eba7939c195f5e3ed073/raw/f30115d1159d540b6866cf28476c9a107be4d930/.bashrc

Change password to something more secure

sudo passwd root

# Fill in root.
# Username and Password will then be `root` and `root`

Forward SSH

First: shutdown the machine

VBoxManage modifyvm "Best 2" --natpf1 "ssh,tcp,,3022,,22"

Start VirtualBox

You can start your VM in headless mode:

  • Open VirtualBox
  • Right Click -> Start -> Headless Start

Connect to SSH

ssh 127.0.0.1 -p 3022 -l root

@DemianD
Copy link
Author

DemianD commented Mar 10, 2018

Start the GUI:

sudo systemctl set-default graphical.target
reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment