I wanted to use putty to connect to my ubuntu on virtual box (comfort reasons,the the VB is just weird. I can't work unless it is on a proper terminal). Anyway,
- Make sure ssh client is installed on your Linux. If not, install it
sudo apt install ssh. - Power downoff the OS.
- Now on your VB go to settings->network->on adapter 1
Settings->Network->onAdapter 1choose host only adapterHost-only adapter->click okOK. - Now start your OS. Run ifconfig;
ifconfig; now the inet address is your IP. - Use this and run it on your putty. Login with your credentials.
The only disadvantage of using host only-only adapter is that your guest OS won't have access to the wider network (eg the Internet).
If you also need your VM to have internet access, leave Adapter 1 as NAT and enable Adapter 2, configured as a Host-Only adapter. This will allow your VM to connect to the internet using NAT as well as make a local connection to your Host using Host-Only.