Import Kali Linux into Google Compute Engine

Kali Linux is an extremely useful tool for penetration testing. Used by cybersecurity experts around the globe, it is an essential piece of equipment with unique capabilities. Unfortunately, though, it is quite heavy-duty. If you don’t have much space on your personal computer, it can be a pain to keep it installed locally. In this article, I will show you how to create a custom Kali Linux Google Compute Engine instance, accessible through SSH.

Before you begin, make sure you have to have a Google Cloud project to which you would like to import the instance. You should also have installed VirtualBox (https://www.virtualbox.org/wiki/Downloads) as well as the Google Cloud SDK (https://cloud.google.com/sdk/) to your machine. Once you’ve done these things, you can begin.

Download Kali Linux

Configure SSHD service

apt-get install openssh-server

Now that you’ve installed openssh-server you can configure the machine to allow for an SSH connection to be made without a password. Don’t worry, your machine will still be secured through Google Cloud Platform; nobody can log in if they don’t have your password. Enter the following command:

vim /etc/ssh/sshd_config

Then, change #PermitRootLogin prohibit-password to PermitRootLogin yes to allow for an SSH connection without a password. To set SSH to run on boot, enter this command:

update-rc.d ssh enable 2 3 4 5

Now that the machine can be connected to effectively via SSH, it’s time to package it up and create the Google Cloud Compute instance.

Upload image to Google Cloud

gsutil mb gs://[BUCKET_NAME]/

Now that you’ve created your bucket, you can upload the image to Google Cloud. To do this, navigate to the directory in which the image is stored. ~/VirtualBox\ VMs is the default directory for VirtualBox images. You can also find the path of the image inside the VirtualBox application. Once you have changed to this directory, run the following command:

gsutil cp [IMAGE_NAME].vmdk gs://[BUCKET_NAME]/[IMAGE_NAME].vmdk

Once the file has been uploaded to Google Cloud, you are ready to import it on Compute Engine.

Import image to Google Compute Engine

gcloud compute images import my-imported-image \
--source-file gs://[BUCKET_NAME]/[INSTANCE_NAME].vmdk \
--os debian-9

And that’s all! Now that you have successfully uploaded the image to Google Compute Engine, go to https://console.cloud.google.com/compute to connect to it via SSH.

Cybersecurity, artificial intelligence, web development, iOS development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store