Setting up (Kali) Linux on Windows 10 Pro Hyper-v

well, since that forces me to travel along blogs and stuff... lets write everything down. this can be basically the same for any Debian, and i guess even Ubuntu.

if i'll write a detailed post it will take forever for something that someone that creates a VM should know, so lets write what is needed.

1. Enabling Hyper-V


from MS DOCS about enabling hyper-v open Windows Powershell with "Run as Administrator" and copy paste this command 

   Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

2. Internet


you have 2 ways to go. External, or Internal/Private.

External means you create a virtual switch that just connects to your computer's internet and is open to the world. don't forget to get an Anti Virus.

Internal/Private means a virtual switch that is not connected to your computer's internet. if you do anything in prod or company or secure, choose this, and go to your default Ethernet connection and share (Properties -> Sharing) it with the Internal, or private for nothing.

for home use, just do an external. and if it doesn't work, it means you just chose the wrong network.

you can check this from Control Panel -> Network and Sharing Center -> Change Adapter Settings, there you should see your vSwitch, and it should not have a red "X" on it. if it does, change the "Connection type" on the switch manager until one works.

3. creating Virtual Machine


go to MS DOCS about creating a new VM for a simpe tutorial, while for Kali Linux, you'll have to choose an .iso yourself, so just download from the Kali Site. use the latest 64bit.

when you will try to run the machine, IF you choose Generation 2, you'll get an error. fix it by Disabling the Secure Boot from the VM security settings, as explained here.

4. Kali settings


you might not have a repository at all, meaning that all you "apt" commands just wont work.

in the Kali web you have the right repository, and your easiest way to open the right file is in the terminal write

   leafpad /etc/apt/sources.list


5. RDP


so following kali forum on how to install xrdp, i'll take the minimum steps needed.

we start by updates and upgrades

   sudo apt-get update -y && apt-get upgrade  -y
   sudo apt-get dist-upgrade -y

i got a window asking to enable a feature that is a security risk, mainly since you run things as root. since its a home machine, i don't mind. for a server of prod machine, you should create a user, and generally never use root.   P.S. all that might take some time

and then the xrdp 

   sudo apt-get install xrdp lxde-core lxde tigervnc-standalone-server -y

now some config editing, start with the xrdp.ini


   sudo leafpad /etc/xrdp/xrdp.ini


and find autorun= and change int to autorun=Xvnc.

now another file

   sudo leafpad /etc/X11/Xwrapper.config

changing the allowed_users=console to allowed_users=anybody (enabling root privileges with the rdp). more info in systutorials.

starting the services to test the connection

   sudo service xrdp start
   sudo service xrdp-sesman start

try to connect, choosing Xnvc. write ifconfig in the terminal to get your machine's IP.

if you make it, then make them to start on startup

   sudo update-rc.d xrdp enable
   sudo systemctl enable xrdp-sesman.service


NOTICE that when you close and open your RDP you will NOT return to you session
couldn't find a solution yet, as all the port games didn't succeed. also it doesnt work if you have the Hyper-V session open.

6. RDP Advanced


rdp shortcut - create a new text file and change it to <whatever>.rpd and right click and "Edit" and set your details, i.e. your machine's IP.

i dont want to choose Xvnc eveytime again.
so in the xrdp.ini just move the [Xvnc]to the top. restart and try.

skipping the username and password : in the [Xvnc] part change the username and password values from ask to root and your password. restart and try. just need to press OK. NEVER UNLESS IN YOUR COMPUTER. i couldn't find a way to remove the log screen, i guess you need a linux client.

NOTICE that from RDP you cant get to "service" in the terminal unless you use sudo.

and make it a bit faster.



7. Google Chrome

ha, everything in linux is hard...

follow this link to install chrome, remember to SAVE the file, and from that directory right click to open terminal before the install command.






Comments

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem

Asp.Net Ending Response options, Response.End() vs CompleteRequest()