The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions
.
google unix.com



Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 09:12 PM
Verifying if the shell command executed or not? eamani_sun Shell Programming and Scripting 3 05-13-2008 04:18 AM
Any way to know wt command has been executed from last 2-3 days ? manoja422002 UNIX for Advanced & Expert Users 3 03-26-2008 10:22 AM
problem executed shell command from PL/SQL alodvg Shell Programming and Scripting 2 08-26-2006 03:58 AM
OpenSSH scp Command mcateriny AIX 2 01-16-2004 11:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-10-2009
DocBrewer DocBrewer is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 6
OpenSSH command not executed

OpenSSH does not execute commands when they are issued from the command line.

I connect from a Win PC to a Win server (2003), using openssh. If I type the name of the bat file from the prompt, it starts. But when I add the command to the ssh command it does not work:

ssh -vvv -i "keyname.key" admin@server "test2.bat"

I've turned on debug mode:

debug1: Sending command: test2.bat
...
test2.bat: not found

Though test2.bat is present, it cannot be found.

I found out that giving "dir" as a command DOES work....
  #2 (permalink)  
Old 03-10-2009
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,963
That's because ssh is looking for "test2.bat" on the remote side, where it probably doesn't exist. You have to copy it there first using scp (or something similar) (assuming the remote side knows how to handle Windows Batch files)
  #3 (permalink)  
Old 03-10-2009
DocBrewer DocBrewer is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 6
It exists on the other side. The other side is a windows 2003 server, so it should know how to execute the file.

Also, when I do not add "test2.bat" to the commandline, but wait for the remote prompt to come up, and I then type "test2.bat", it will run!
  #4 (permalink)  
Old 03-10-2009
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,963
Could be because the ssh daemon tries to launch the batch file as a standalone executable (which it isn't). Try this
Code:
ssh -vvv -i "keyname.key" admin@server "cmd /c test2.bat"

  #5 (permalink)  
Old 03-10-2009
DocBrewer DocBrewer is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 6
Great, this works!

Thanks for the quick reply.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0