The question is published on by Tutorial Guruji team.
For testing purposes, I am automating creation of configured EC2 machines. The creation/configuration is done via ssh connection (same logic for various OSs). On windows (Windows 2003 Server), there is cygwin with ssh pre-configured, so that I can ssh there.
As part of the configuration, I need to install given version of Java SDK. I upload the exe installer (jdk-6u34-windows-i586.exe) to the machine and run it with the /s parameter (silent install). When I run this from windows console (in remote desktop) or even via cygwin in remote desktop, it works perfectly. But when I ssh to there and run it in cygwin via ssh, if fails.
The fail seems to be quite strange, since the installer partially extracts it’s content into
c:Documents and SettingsAdministratorApplication DataSunJavajdk1.6.0_34 and then it fails with exit code 67. The number of files extracted before exit varies.
When doing this programatically using Java and
Jsch, the command also prints error message
initgroups: Permission denied to the error stream. I don’t see this message when I connect manually via ssh, so I am not sure, if it’s related (when googling, I found this error occuring in completely different context, which did not help me).
I would welcome any explanations, why this happens (and how to fix/work around it). Other hints how to reliably automatically install given JDK on EC2 windows machine are welcomed as well. Thanks.
It turned out, that there is some intentional architectural separation in Windows (from some version), that services can not access UI.
As the cygwin ssh-daemon was running as a service, it could not make UI calls or start UI-based programs. The JDK installer was UI-based (it seemed to do something UI-ish even in silent mode), which got forbidden.
When running the same from Remote Desktop session, it all worked fine, since there the UI was accessible.