I needed Kali Linux to make a Wifi hotspot.
Here are the necessary commands to install Kali on Virtualbox on Ubuntu 18.04.

Install Virtualbox

1
2
sudo apt update
sudo apt upgrade

Import the Oracle public key to your system:

1
2
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

Add Oracle VirtualBox PPA. The command below will add an entry at the end of the file /etc/apt/sources.list.

1
sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian bionic contrib"

Install:

1
2
sudo apt update
sudo apt install virtualbox-6.0

Install Network tools

1
apt-get install inetutils-tools bridge-utils -y

Create VM via command lines

1
2
3
4
5
6
7
8
9
10
11
12
13
vboxmanage createvm --name "kalivm" --ostype Ubuntu_64 --register
vboxmanage modifyvm "kalivm" --memory 4096 --acpi on --cpus 2
vboxmanage modifyvm "kalivm" --nic1 bridged --nictype1 82545EM --bridgeadapter1 eno1
vboxmanage storagectl "kalivm" --name "IDE Controller" --add ide --controller PIIX4
vboxmanage createhd --filename "/home/olivier/VirtualBox VMs/kalivm/kalivm.vdi" --size 20000
vboxmanage storageattach "kalivm" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/home/olivier/VirtualBox VMs/kalivm/kalivm.vdi"
vboxmanage storageattach "kalivm" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/olivier/Downloads/kali-linux-2019.2-amd64.iso
vboxmanage startvm "kalivm" --type headless

# stop vm
vboxmanage controlvm "kalivm" poweroff
# delete vm
vboxmanage unregistervm "kalivm" --delete

Enable ssh on Kali

1
2
3
4
5
sudo apt-get update
sudo apt-get install -y ssh

systemctl enable ssh
systemctl start ssh

Change password

Kali use root/toor as default linux credentials. Do not forget to change them…

SSH with password

If you want to SSH to your Kali VM with a password you need to edit the /etc/ssh/sshd_config file and change the line PermitRootLogin prohibit-password by this one PermitRootLogin yes. (Uncomment it also…)

Once it is done restart the ssh service service ssh restart.

Install extension pack

To access USB devices from the Host inside the VM the extension pack is necessary.

1
2
3
4
5
vboxversion=$(wget -qO - https://download.virtualbox.org/virtualbox/LATEST.TXT)

wget "https://download.virtualbox.org/virtualbox/${vboxversion}/Oracle_VM_VirtualBox_Extension_Pack-${vboxversion}.vbox-extpack"

sudo vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-${vboxversion}.vbox-extpack

Once it is installed it is important that your host user belongs to the vboxusers group. If it does not Virtualbox won’t ba able to access the host USB.

To add your user in the vboxusers group just execute:

1
sudo usermod -a -G vboxusers your_user