This is the first article in a short series on building a virtual hacking lab. For the purposes of this series, we will be installing several client VMs on a Kali Linux host machine. Firstly we will be looking at installing and configuring VirtualBox and setting up a basic Windows 7 Virtual machine. We will then look at installing some more interesting clients, finishing off with a look at virtualised networks and building a test lab to emulate a small business.
Firstly lets get VirtualBox installed. VirtualBox lives in the Kali repo so installation is as simple as:
sudo apt install virtualbox
This will grab and install any prerequisites needed. Once complete you can start VirtualBox from the applications menu or running
in the terminal. Next well start creating a new Windows 7 Service Pack 1 Client. For this you will obviously require a Windows 7 installation ISO.
Click "New" to start the wizard. Enter a name for the new client VM, i've used "Windows7-SP1".
The default settings provided by VirtualBox are ample for our purposes. So continue with 512 MB RAM.
We will create a dynamically allocated virtual drive now. Dynamically allocated means the drive will only use the required space on your drive and won't take up unneccesary space on your drive.
If required you can reduce the size of the drive. I'd recommend no less than 15 GB, you can also chose a seperate save location for the drive. It may be neccessary to store the virtual disks on a secondary drive so as you can end up with quite the collection!
Once the wizard is done we are back at the the dashboard and can see our newly created client. Before starting it up we are going to tweak some of the VMs settings. With the VM selected click settings.
Now we can see all the internal settings of the VM. We need to change the network mode to host only and mount our installation media.
A quick walkthrough on creating a new non-root user on Kali Linux and adding this user to the sudoers. In this brief guide we will add a user called dan and add this user to the sudoers group. To get started open a terminal window. With the window now open issue the following command
useradd -m dan
This will add a new user named dan, the -m option creates a home directory for the user. This home directory will usually be located at /home/dan unless your default home directory location has been changed. Next lets add a password to the account.
In your terminal window issue the following command.
This will prompt you to enter a password for the newly created user.
Now its time to add the user to the sudoers group. This will allow the user to execute commands with root privileges by prefixing the command with sudo and entering their password.
usermod -a -G sudo dan
The -a option tells usermod you are adding, -G sudo means the group sudo and then the user. Now we have added the user, set a password and added them to sudoers, we must specify a shell for the user.
chsh -s /bin/bash dan
This command changes the shell to the one specified after -s for the user. After this you are all done. You can logout of root and login as your newly created user. Any commands or scripts requiring elevation can be executed by prefixing with sudo and entering the users password.