1

This question is a follow up of this one. I am trying to run a command through the command line on a remote machine running Windows 7 from a workstation running Debian in an SSH session on that machine. The setup is basically as follows:

debian box 1 === (SSH) ===> debian box 2 === (RDP) ===> Windows 7

I have tried running rdesktop from debian box 2:

rdesktop <Windows 7 box network address> -u username -p password -r disk:local="./TestRDP" -s "cmd.exe /K net use C: \\\\tsclient\local & C:\\test.bat & logoff"

but cmd.exe is not launched on the remote device. I have also tried to open up cmd.exe on its own:

rdesktop <Windows 7 box network address> -u username -p password -s "cmd.exe"

but the terminal is not launched upon login (rdesktop successfully connects through RDP).

I also tried using FreeRDP:

xfreerdp /u:user /p:password /app:"||cmd" /v:<Windows 7 box network address>

but this error was given upon executing cmd.exe:

RAIL exec error: execResult=RAIL_EXEC_E_NOT_IN_ALLOWLIST NtError=0x15

Reading this (dated) blog entry it is recommended that a registry key is added with the path to the binary (%windir%\System32\cmd.exe) but I cannot edit registry values on the remote machine.

This question suggests using windows remote shell and a third party rdp client to run the terminal on the remote windows machine. Are there any linux alternatives (aside from FreeRDP and rdesktop)?

Sebi
  • 1,134
  • 4
  • 19
  • 29
  • when you say the "CMD is not launched on the remote device", did you check for a process, or are you testing based on a window actually appearing on a desktop? – Frank Thomas Apr 13 '16 at 15:01
  • Yes, I am checking for the latter. I also ran task manager on the remote machine and there is no cmd.exe process launched. – Sebi Apr 13 '16 at 15:12
  • Your command looks way wrong. you cannot map a network drive (net use) to C: on any windows system. Additionally, from the cmd documentation, the expression following a /k incocation must be in quotes. https://technet.microsoft.com/en-us/library/bb490880.aspx have you tried supplying a full path to cmd.exe? it seems like the rdesktop -s switch is failing to substitute the shell. – Frank Thomas Apr 13 '16 at 15:30
  • Yes, I've tried launching cmd only: rdesktop 192.168.2.19 -u user -p password -s "C:\Windows\System32\cmd.exe" and cmd.exe is not launched. – Sebi Apr 13 '16 at 15:38
  • does the user specified have full admin on the windows box? this is necessary to change the session shell. also see if this solution works for you: http://unix.stackexchange.com/questions/171331/how-to-execute-windows-commands-remotely-from-linux-machine-using-rdesktop-comma – Frank Thomas Apr 13 '16 at 15:54
  • Yes, the user I'm logging in as has full admin rights. I've looked over the linked question. The problem is that I mustn't use any software aside from the RDP client (I have no previous access to the windows machine). – Sebi Apr 14 '16 at 07:19

2 Answers2

0

you have to open a port on your firewall to let clients connect to it, SSH runs on port 22, so that's the port you want to forward.

If you run the KDE desktop, you might prefer krdc tuto, the KDE RDP viewer. The command line would look like this:

krdc --window --high-quality rdp:/1.2.3.4[:3389]

replace "1.2.3.4" with the host IP address, and 3389 with a different port if necessary.

GAD3R
  • 3,702
  • 2
  • 18
  • 32
  • I manage to connect to the second workstation through SSH successfully, even to the windows workstation from that one, but I'm unable to launch any binaries on the windows machine through clients such as rdesktop and freerdp. – Sebi Apr 14 '16 at 07:21
-1

The program you are trying to launch is not in the allowed programs list. This list can be found on Windows 2008 RC2 under Administrative Tools -> Remote Desktop Services -> RemoteApp Manager

If this menu entry is not found then follow this guide Install Terminal Server Role.

  • Link-only answers are not helpful. Your answer by itself should answer the question, you can quote and cite your reference link, but your answer itself must answer the question. – Ramhound Jan 19 '17 at 16:46
  • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill Jan 20 '17 at 13:39