I am trying to ssh (from windows) into my Openshift app using the 'rhc' command rhc app-ssh <app name> I have followed the Openshift instruction here: https://www.openshift.com/forums/openshift/how-to-rhc-app-ssh-command Putty is returning the error "Putty Command Line Error: unknown option "-V" and then fails. My google searches indicate putty has a "-v" (lowercase) option for turning on Verbose. I'm not sure if it's one in the same. If I use the Putty GUI everything works fine. I would like to figure out how to ssh into my openshift app using the command line. How do I ssh into my openshift app using the 'rhc' command on windows?
Please provide the following information: - Windows version - Which shell tool are you using (pure cmd.exe, Git BASH, Cygwin, etc) - The result of running "path" in the command line - The result of running "ruby -v" in the command line - List the files you have in "C:\Documents and Settings\<username>\.ssh\" or "C:\Users\<username>\.ssh"
- Windows version Windows 7x64 - Which shell tool are you using (pure cmd.exe, Git BASH, Cygwin, etc) pure windows cmd.exe - The result of running "path" in the command line PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Ruby200-x64\bin;C :\Python33\;C:\Python33\scripts;C:\Windows\system32;C:\Windows;C:\Windows\System 32\Wbem;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x 86)\FileBot\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\Win dowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files\Mercurial\; C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\PuTTY;c:\slime rjs-0.9.2 - The result of running "ruby -v" in the command line ruby 2.0.0p0 (2013-02-24) [x64-mingw32] - List the files you have in "C:\Documents and Settings\<username>\.ssh\" or "C:\Users\<username>\.ssh" id_rsa id_rsa.ppk id_rsa.pub known_hosts Puttyppk_converted_to_openssh I my Putty folder :C:\Program Files (x86)\PuTTY putty.exe and ssh.exe are the same file. FYI. I just tried using the below Git Bash shell command and it worked. So the problem seems to be focused on the windows cmd.exe shell. rhc ssh-app <app name>
Fixed in: https://github.com/openshift/rhc/pull/654 This pull request introduces the following improvements: On Windows, rhc will try its best to auto-discover ssh and git executables available across the system, even if they are not in the system PATH. The following tools will be searched for: ssh.exe tool from msysgit, plink.exe from PuTTY and putty.exe from PuTTY. A few locations where these tools will be searched: PATH C:\Program Files\Git\bin C:\Program Files (x86)\Git\bin C:\Program Files\PuTTY C:\Program Files (x86)\PuTTY C:\Git\bin C:\PuTTY C:\ If the Windows installation has more drives (D:, E:, etc) they will also be searched, on the same locations. The --ssh flag can still be used if other ssh tools are preferred over the ones rhc will search for. This flag now supports path with spaces between commas (e.g. --ssh "C:\Program Files\MySshTool\ssh.exe". It's important to mention that *msysgit is preferred over PuTTY* because it handles SSH keys in standard formats, while PuTTY uses it's own *.ppk format.
Use fork_ami_bug_1149016_1262.
1.In the path "C:\Program Files (x86)\Git\bin" there is ssh.exe 2.In the path "C:\" there is putty.exe 3.Use the command to ssh (from windows) into my Openshift app rhc app-ssh <app name> execute result: Putty is showing the error tip window "Putty Command Line Error: unknown option -V". Then click twice the button "ok" , we can ssh into the app successfully. 4.Remove the putty.exe from the path "C:\", execute the "rhc app-ssh <app name>" again. we can ssh into the app successfully and there is no error tip window. 5.Execute the command "putty.exe -V" in windows cmd terminal.It also show the error window "Putty Command Line Error: unknown option -V". There is an error option "-V" send to putty.exe when use rhc command to load putty.exe.
Fixed in fork_ami_bug_1149016_1263
1、Delete or rename the ssh.exe 2、Use command the "rhc app-ssh <app name> --ssh "putty.exe -i key_file.ppk""to connect the app. or use pageant.exe tool to add the putty key_file and then use command "rhc app-ssh <app name>" to connect the app. 3、Connect the app successfully.
(In reply to madeshuai from comment #7) > 1、Delete or rename the ssh.exe > 2、Use command the "rhc app-ssh <app name> --ssh "putty.exe -i > key_file.ppk""to connect the app. or use pageant.exe tool to add the putty > key_file and then use command "rhc app-ssh <app name>" to connect the app. > 3、Connect the app successfully. Additional: rhc version : 1.31.3(build from source code on server fork_ami_bug_1149016_1263) online server: fork_ami_bug_1149016_1263
Commits pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/0fb5bff8a042d196a178483606973a3047820bb7 Bug 1149016 - ssh auto-discovery on Windows https://github.com/openshift/rhc/commit/a9bd6168abfb8e0cd7057e87111a0edc2a84223f Bug 1149016 - git auto-discovery on Windows
This change of adding quotes to the ssh command: https://github.com/openshift/rhc/commit/a9bd6168abfb8e0cd7057e87111a0edc2a84223f#diff-6bb233c6bcab1f993ce51cdf1cd4cbdeL512 breaks things, at least in a non-windows environment: $ rhc -d snapshot save --ssh 'ssh -v' 21node [...] DEBUG: "ssh -v" 54735971e659c5985e000002.example.com 'snapshot' > 21node.tar.gz Pulling down a snapshot of application '21node' to 21node.tar.gz ... sh: ssh -v: command not found $ rhc -d ssh --ssh 'ssh -v' 21node [...] Connecting to 54735971e659c5985e000002.example.com ... DEBUG: Using user specified SSH: ssh -v DEBUG: Invoking Kernel.exec with ["ssh -v", "-vvv", "54735971e659c5985e000002.example.com"] /home/pep/.gem/ruby/gems/rhc-1.32.2/lib/rhc/commands/ssh.rb:45:in `exec': No such file or directory - ssh -v (Errno::ENOENT) from /home/pep/.gem/ruby/gems/rhc-1.32.2/lib/rhc/commands/ssh.rb:45:in `run' [...]
Fixed in https://github.com/openshift/rhc/pull/661
Commit pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/81a6e5ada0d72e5e020bda14c3622ed52f233f60 Bug 1149016 - fixes ssh path with commas
Version-Release number of selected component (if applicable): rhc version : 1.33.1(build from source code on server devenv_5325) online server: devenv_5325 the client is linux env. steps to Reproduce: 1、create a app on the server # rhc app-create -a app1 php-5.3 2、use "-d" to ssh a app. can connect the app successfully. But when input some command in the terminal, it print lots of info, and can't input normal. $ rhc -d ssh --ssh 'ssh -v' app1 [app1-eveusb.dev.rhcloud.com 54786f62fd0bc76401000024]\> debug3: Wrote 48 bytes for a total of 3021 jdebug3: Wrote 48 bytes for a total of 3069 debug3: Wrote 48 bytes for a total of 3117 fdebug3: Wrote 48 bytes for a total of 3165 jdebug3: Wrote 48 bytes for a total of 3213 fdebug3: Wrote 48 bytes for a total of 3261 jdebug3: Wrote 48 bytes for a total of 3309 fdebug3: Wrote 48 bytes for a total of 3357 jdebug3: Wrote 48 bytes for a total of 3405 jjdebug3: Wrote 48 bytes for a total of 3453 debug3: Wrote 48 bytes for a total of 3501 debug3: Wrote 48 bytes for a total of 3549 debug3: Wrote 48 bytes for a total of 3597 debug3: Wrote 48 bytes for a total of 3645 debug3: Wrote 48 bytes for a total of 3693 debug3: Wrote 48 bytes for a total of 3741 debug3: Wrote 48 bytes for a total of 3789 jdebug3: Wrote 48 bytes for a total of 3837 jdebug3: Wrote 48 bytes for a total of 3885 jjjjjjjjdebug3: Wrote 48 bytes for a total of 3933 debug3: Wrote 48 bytes for a total of 3981 jjdebug3: Wrote 48 bytes for a total of 4029 ldebug3: Wrote 48 bytes for a total of 4077 fdebug3: Wrote 48 bytes for a total of 4125 fdebug3: Wrote 48 bytes for a total of 4173 debug3: Wrote 48 bytes for a total of 4221 kdebug3: Wrote 48 bytes for a total of 4269 fk
Unable to reproduce, I got similar debug messages when connecting but I was able to use it normally after connecting. If you still see the issue please provide more info. Notice that "--ssh 'ssh -v'" was used to test the ssh flag with blank spaces, but it's actually redundant since the debug flag "rhc -d" will already put ssh on debug mode through "-vvv".
Fixed in https://github.com/openshift/rhc/pull/663. Lowered the verbosity of ssh debug to level 2 instead of 3.
Commit pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/1569c48d6d70fa9c70f6eef5a8bab7e32c4ffe54 Bug 1149016 - lowering verbosity of ssh debug messages
Commit pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/f8e380a9b1351e7c742fbfd260e6d33a03753575 Bug 1149016 - lowering verbosity of ssh debug messages
Version-Release number of selected component (if applicable): rhc version : 1.33.3(build from source code on server devenv_5325) online server: devenv_5335 os env : rhel6.5 steps to Reproduce: 1、create an app # rhc app-create -a app1 php-5.3 2、use "-d" to ssh a app. can connect the app successfully and the terminal input normal $ rhc -d ssh app1 [app1-eveusb.dev.rhcloud.com 547eeedce9c7a63350000002]\> ls app-deployments app-root gear-registry git haproxy unified-push Actual results: the terminal input normal Expected results: the terminal input normal
One remaining issue and an additional question. The issue: on non-windows, the problem mentioned in comment #10 has only been fixed for the 'rhc ssh' command, but the snapshot command still doesn't work if --ssh is used to add ssh options: $ rhc -d snapshot save --ssh 'ssh -i ~/.ssh/id_test' test [...] DEBUG: "ssh -i ~/.ssh/id_test" 5492a859ecb0ca0b4f00000b.com 'snapshot' > test.tar.gz Pulling down a snapshot of application 'test' to test.tar.gz ... sh: ssh -i ~/.ssh/id_test: No such file or directory DEBUG: Error in trying to save snapshot. You can try to save manually by running: "ssh -i ~/.ssh/id_test" 5492a859ecb0ca0b4f00000b.com 'snapshot' > test.tar.gz Switching back to ASSIGNED for this. The question: a customer just reported that rhc has troubles finding git/ssh; we're still checking details (versions, install locations etc) but meanwhile: it looks like the code (discover_windows_exectuables) searches in %ProgramFiles% and some default locations, but not %PATH% - is that right? Shouldn't we search PATH too?
> The question: a customer just reported that rhc has troubles finding > git/ssh; we're still checking details (versions, install locations etc) but > meanwhile: it looks like the code (discover_windows_exectuables) searches in > %ProgramFiles% and some default locations, but not %PATH% - is that right? > Shouldn't we search PATH too? We do search for it on %PATH, that's provided by guessing locations without an explicit base path: https://github.com/openshift/rhc/blob/master/lib/rhc/ssh_helpers.rb#L434 https://github.com/openshift/rhc/blob/master/lib/rhc/ssh_helpers.rb#L442
> We do search for it on %PATH, that's provided by guessing locations without > an explicit base path: > > https://github.com/openshift/rhc/blob/master/lib/rhc/ssh_helpers.rb#L434 > https://github.com/openshift/rhc/blob/master/lib/rhc/ssh_helpers.rb#L442 The execute command is error. When we combine the string to run, the command string should be " ssh -i ~/.ssh/id_test 5492a859ecb0ca0b4f00000b.com 'snapshot' > test.tar.gz " not " "ssh -i ~/.ssh/id_test" 5492a859ecb0ca0b4f00000b.com 'snapshot' > test.tar.gz " we have Additional colon. https://github.com/openshift/rhc/blob/master/lib/rhc/ssh_helpers.rb#L255 https://github.com/openshift/rhc/blob/master/lib/rhc/ssh_helpers.rb#L294
I think this will be fixed by https://github.com/openshift/rhc/pull/668
Commit pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/285f6cc79e4750aa98b5033f450a0430c5c7b71c Bug 1149016 - allow spaces in paths for --ssh flag but still allow arguments. Executable path must be quoted within the string with escaped quotes if it contains spaces in the path
See the updated help text for 'rhc app ssh --help' that explains how to properly escape an ssh executable path with a space in it. This should now work when the executable has a space in the path and arguments are passed.
Version-Release number of selected component (if applicable): rhc version : 1.34.1(build from source code on server devenv_5381) online server: devenv_5381 os env : rhel6.5 win7 steps to Reproduce: 1、create an app # rhc app-create -a app1 php-5.3 2、on rhel system, use "--ssh" to ssh, snapshot save and restore the app. # rhc -d app-ssh -a app1 --ssh 'ssh -i ~/.ssh/id_rsa' # rhc -d snapshot save --ssh 'ssh -i ~/.ssh/id_rsa' app1 # rhc -d snapshot restore --filepath=app1.tar.gz --ssh 'ssh -i ~/.ssh/id_rsa' app1 3. on win7 system C:\Users\Win7x64\.ssh> rhc -d ssh app1 --ssh "ssh.exe -i id_rsa" C:\Users\Win7x64\.ssh> rhc -d snapshot save --ssh 'ssh.exe -i id_rsa' app1 C:\Users\Win7x64\.ssh> rhc -d snapshot restore --filepath=app1.tar.gz --ssh "ssh.exe -i id_rsa" app1 Actual results: the step 2 and 3 is no error. Expected results: the step 2 and 3 is no error.