Running commands remotely through an RDP connection












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: \\tsclientlocal & 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%System32cmd.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)?










share|improve this question

























  • 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. 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:WindowsSystem32cmd.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: unix.stackexchange.com/questions/171331/…

    – Frank Thomas
    Apr 13 '16 at 15:54


















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: \\tsclientlocal & 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%System32cmd.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)?










share|improve this question

























  • 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. 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:WindowsSystem32cmd.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: unix.stackexchange.com/questions/171331/…

    – Frank Thomas
    Apr 13 '16 at 15:54
















1












1








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: \\tsclientlocal & 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%System32cmd.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)?










share|improve this question
















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: \\tsclientlocal & 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%System32cmd.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)?







linux windows command-line ssh remote-desktop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:37









Community

1




1










asked Apr 13 '16 at 14:47









SebiSebi

317822




317822













  • 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. 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:WindowsSystem32cmd.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: unix.stackexchange.com/questions/171331/…

    – Frank Thomas
    Apr 13 '16 at 15:54





















  • 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. 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:WindowsSystem32cmd.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: unix.stackexchange.com/questions/171331/…

    – Frank Thomas
    Apr 13 '16 at 15:54



















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





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







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. 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





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. 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:WindowsSystem32cmd.exe" and cmd.exe is not launched.

– Sebi
Apr 13 '16 at 15:38





Yes, I've tried launching cmd only: rdesktop 192.168.2.19 -u user -p password -s "C:WindowsSystem32cmd.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: unix.stackexchange.com/questions/171331/…

– Frank Thomas
Apr 13 '16 at 15:54







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: unix.stackexchange.com/questions/171331/…

– Frank Thomas
Apr 13 '16 at 15:54












2 Answers
2






active

oldest

votes


















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.






share|improve this answer
























  • 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 7: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.






share|improve this answer
























  • 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












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1065034%2frunning-commands-remotely-through-an-rdp-connection%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









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.






share|improve this answer
























  • 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 7:21
















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.






share|improve this answer
























  • 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 7:21














0












0








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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 13 '16 at 18:32









GAD3RGAD3R

2,4421226




2,4421226













  • 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 7:21



















  • 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 7:21

















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 7:21





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 7: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.






share|improve this answer
























  • 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
















-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.






share|improve this answer
























  • 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














-1












-1








-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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 19 '17 at 16:06









miha-x86miha-x86

1




1













  • 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



















  • 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

















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





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





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


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1065034%2frunning-commands-remotely-through-an-rdp-connection%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido