3

I am trying to find a lightweight way to start an application on a remote Windows7 machine from linux.

The following are my boundary conditions:

  • The Windows7 system is located in the same subnet on the same LAN as the Linux machine.
  • If needed, a local user account with administrator privileges is available on that machine and the password is known.
  • The application which should be started on the windows machine needs to show a Window. It is not just a process.
  • No further interaction should be necessary on the windows7 system.
  • I don't want to install a full blown cygwin on that system.
  • I tried to use the linux equivalent of psExec (winexe) but I still needed to acknowledge some warning on the windows7 machine.

Using psExec from another windows7 machine works, but I have to start a process on the windows machine from a linux host.

Edit:

I am free to install additional software, but I don't want to install mysys or cygwin.

The application needs to start immediately (that is as soon as the linux machine triggers the "start the application"). IMO polling isn't an option.

As I found out, the warning windows7 shows when it should invoke a command from winexe is a feature called "session 0 isolation" and haven't found a way to turin it off.

3
  • I don't understand what you are talking about when you say you needed to acknowledge a warning with winexe. Perhaps you should just ask a question that is primarily about your problems with winexe.
    – Zoredache
    Jan 25, 2012 at 22:56
  • The warning is a security warning by windows7. It informs the user that a remote program wants to display a message. If you confirm the warning, windows switches to a new desktop and executes the program. I can try to make screenshots if it is really needed.
    – tobsen
    Jan 26, 2012 at 8:14
  • @Zoredache The warning pops up due to the "Session 0 Isolation" feature of Windows7.
    – tobsen
    Jan 26, 2012 at 13:59

4 Answers 4

1

RSHD will do exactly what you are looking for. It can run in the context of the currently logged on user, and listens on a port for incoming connections from pre-authorised hosts. You could send a command (e.g. calc.exe) and have the app appear on the user's desktop.

Note that there are many implementations, and I wouldn't like to recommend one over another, some run as a service, but you will probably need to find one that runs in the context of the logged on user to do what you are asking.

Edit in response to the comment:

I've used this one in the past to do exactly as you are asking. It's lightweight, just a standalone binary.

Firstly, on the windows PC create a rhosts file and save it as c:\windowsrhosts (note this isn't a typo, this file exists in the root of the C: drive). The file should contain the FQDN of the remote linux computer you are going to connect from, followed by the username, e.g.

remotepc.example.com bryan

Next, create a batch file that executes on logon, with the following command

rshd.exe -d

This will leave a command prompt window, which you can minimise.

Download a RSH client on your Linux PC (I've only tested using a Windows RSH client)

I've just tested, and have launched calc using the following command

rsh windowspc.example.com -l bryan calc

...and up popped calc.exe on the Windows desktop.

3
  • I guess my google-fu isn't good today. I only found out that there is rshd and the official ones in Microsoft's Utilities and SDK for Subsystem for UNIX-based Applications. Still, I didn't find a lightweight rsh server which is capable of doing those things. Maybe you can - even if you initially refused to name a tool - name a specific tool? Thanks for you answer so far :)
    – tobsen
    Jan 26, 2012 at 15:59
  • @tobsen - Answer updated
    – Bryan
    Jan 26, 2012 at 16:46
  • great, thanks! Will try that out and accept it if it works :)
    – tobsen
    Jan 27, 2012 at 7:47
1

I know this thread is 3 years old but here is a solution I found.

For some reason, winexe's '--interactive=1' does not behave like psexec's '-i' option. With winexe, the user will still have to accept an 'Interactive service detection' dialog.

A possible solution is:

1 - using smbclient or CIFS shares to upload psexec to the windows machine. 2 - (optionally) uploading the GUI program that you want to run. 3 - running the GUI program through psexec through winexe. Like this:

winexe --uninstall --interactive=0 -U 'WinAdmin%WinAdminPasswd' //1.2.3.4 '\windows\temp\psexec.exe -i \\127.0.0.1 -u WinAdmin -p WinAdminPasswd notepad.exe

And notepad will successfully appear on the logged-on user's desktop.

In case the 'Interactive services detection' dialog still appears, the service must be disabled beforehand and then re-enabled:

winexe --interactive=0 -U 'WinAdmin%WinAdminPasswd' //1.2.3.4 'cmd /c sc config UI0detect start= disabled > NUL & sc stop UI0detect > NUL'
// (do your stuff)
winexe --interactive=0 -U 'WinAdmin%WinAdminPasswd' //1.2.3.4 'cmd /c sc config UI0detect start= manual > NUL & sc start UI0detect > NUL'
0

You said you don't want to install cygwin, but are you willing to install anything else on the Windows computer? You could install a SSH server on the Windows computer, or install the telnet server feature (not very secure, would advise against unless the computer is securely firewalled).

Another option would be something more of a kludge. Then post a blank batch file somewhere, say a samba share on your linux computer, with read/write access. Then create a task on the Windows 7 computer that executes another batch file every 5 minutes. In said script, have the first line download your blank script to the Windows 7 computer and the second line call that batch file as script calling another script. Normally this file is blank, so when the task runs it downloads a blank script, then calls that script (which does nothing), then exits. When you want to "run a command", just change your script to have said command as the first line and a second line that clobbers the (normally blank) script on the share, overwriting it with a blank file (to prevent your command from being executed a second time).

I'd just install a SSH server and SSH in, but figure that might be an "out of the box" way to get it done without the need to install a single bit of software on the Windows pc...

1
  • I edited my question to be more precise. Is there a lightweight, free (opensource?) SSH server for windows which runs as a service and is capable of those things I mentioned above?
    – tobsen
    Jan 26, 2012 at 8:39
-1

How about RDP or VNC client from linux - for example Remmina (you can define screen res. color deep, even windows credentials) or krdc For RDP you don't need to install anything - just enable remote desktop

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .