winexe 1.00, Linux/MacOS, Windows 7; finally working

For a few weeks I’ve been trying to get winexe compiled, running, connecting, and working from both Linux (Ubuntu 11.04) and MacOS X (Snow Leopard, 10.6.x), to a Windows 7 system. But could never find a complete solution, only fragments of information. This may help anyone trying to piece things together as I did.

First, on the Windows system you want to remote connect to:

  • If you have the firewall enabled, enable “Inbound Rules” -> “Remote Service Management (NP-In)” (I figured this out by trial and error)
  • Add this to the registry (see this and this)
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

Then on Linux/Mac, get and build from latest source; 1.00 as of this post.

wget http://sourceforge.net/projects/winexe/files/winexe-1.00.tar.gz/download -O winexe-1.00.tar.gz

tar xf winexe-1.00.tar.gz

On Mac, there’s a patch you have to apply (see the note under “For Mac OS X:” here; I created the tinypaste link for convenience)

wget http://tinypaste.com/70837/save.php?hash=0 -O 1.patch

patch -p0 < 1.patch

Then continue:

cd winexe-1.00/source4

./autogen.sh

./configure

make

./bin/winexe -U “<user>%<password>” //<windows system> cmd.exe


Notes:

On Ubuntu, some of the packages that I had to install (I don’t remember all of them) are: autoconf, python-dev.

On Mac, I’m using homebrew for missing standard *nix packages/utilities, like wget.

Some sites I’ve read mention running “make proto bin/winexe”, instead of “make”. This failed for me, so I just ran the full make.

Some sites I’ve read mention patching source4/winexe/service.c, changing the line

#define NT_STATUS_SERVICE_DOES_NOT_EXIST NT_STATUS(0xc0000424)

from 0xc0000424 to 0x00000424. I tried this. winexe worked fine without changing this line, and didn’t work when I did change it.

Now that I have it working, I can’t get some basic key mappings working, like the backspace key. But that’s a separate issue.

In case the Mac patch should disappear for some reason, the single change is in source4/winexe/winexe.h. Change

struct tevent_context *ev_ctx;

to

extern struct tevent_context *ev_ctx;