Monday, May 30, 2016

Fixing VMWARE tools on kali linux to enable copy paste properly - especially when you are doing OSCP

Hi Folks,

So if you are playing around with kali linux on a VM you might have faced the issue of getting the vmware tools work properly. Especially when you want to copy paste files and clipboard contents between guest and host. This is very annoying thing and took lot of my precious time when i was doing OSCP course. Here is how i fixed it.

My Setup

I run a kali linux distro on vmware player which is recommended for doing the OSCP course. By default it has GNOME as the default GUI. I kind of hate it as it uses lot of resources and has all those stupid animations and stuff. I want something clean and precise when i am working, i am not into looks and too many features, just the bare minimum responsive system is always my favourite.

So I installed LXDE which is light weight GUI for linux. you can install it with following command

apt-get install lxde-core lxde kali-defaults kali-root-login desktop-base

This will not make LXDE you default GUI, so if you reboot, you will need to choose LXDE from the menu while logging in. To make it default you can run the command

 update-alternatives --config x-session-manager

Now you will be presented with a wizard like interface to choose default GUI, choose LXDE if you want to make it default GUI.

First things First

First of all, Kali Linux new versions comes with open vm tools pre installed, this should supposedly enable all functionalities but unfortunately it doesn't work just like that. So typically eveyone installs VMware tools on top of this.

To fix it properly first remove any additional libraries that you have installed, in my case its vmware tools. To uninstall it you have to issue the command


if you have virtualbox additions you can uninstall it  by the something like this (based on version it may differ)


just make sure its all gone for good

sudo aptitude purge virtualbox-guest-x11 virtualbox-dbg virtualbox-dkms

Now uninstall open vm tools

aptitude purge open-vm-tools open-vm-tools-desktop open-vm-tools-dkms

Remove any residual files

rm -rf /etc/vmware-tools/

Now that everything is properly gone. Do a restart to clean up everything.

Lets start

Lets install open vm tools properly

apt-get install open-vm-tools open-vm-tools-desktop fuse

Now open the file /etc/rc.local on a text editor and add following lines towards the end of file just before the exit 0 statement

sudo mkdir /var/run/vmblock-fuse
sudo su -l -c "vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse"

Now create a file /root/.config/autostart/copypaste-autostart.desktop with following contents

[Desktop Entry]
Name=copypaste start
Comment=Start copy paste and drag n drop for vm tools
Now create a file /root/Desktop/OSCP/setup/  (note: you can create in any location, just make sure to add that location on the previous step file contents for parameter Exec) with following contents

#!/bin/sh -e
sudo chmod u+s /usr/bin/vmware-user-suid-wrapper

Thats it. Now restart and you should have copy paste functionality working properly. In case drag and drop does not work, just right click copy and then paste it works everytime for me.

Enjoy. Please do provide your feedback.