Operating System - OpenVMS
1758260 Members
2644 Online
108868 Solutions
New Discussion юеВ

SSH remote command execution fails from batchmode

 
Gerhard Olsson
Advisor

SSH remote command execution fails from batchmode

When I execute a command on a remote host using SSH single commands, the command fails on the remote host. The reason seems to be that the remote pseudo terminal is not setup properly, and a program called by the script fails.

This could be a problem with the remote program, but this works fine from DCL interactive mode when I specify batch mode. There seem to be something that is different from batch. However, I can see that a pseudo terminal is allocated on the remote system, both from interactive and batchmode. If in interactive mode, batch mode is enabled from command line.

Example:
$ ssh -t -o "BatchMode yes" testuser@10.1.2.57 "testscript parameter"

Where test script is like:
#!/bin/sh
who am i
OtherProg $*

Output like:
testuser /dev/pts/2 Oct 18 15:05
failure to get parameter to OtherProg


OpenVMS 7.3-2, TCPIP 5.4 ECO5
Remote: Solaris 9 (OpenSSH based)
Public key authentication, without password

Hints what is happening in batch mode, or shall I blame the Solaris program?

/Gerhard
5 REPLIES 5
Arch_Muthiah
Honored Contributor

Re: SSH remote command execution fails from batchmode

Please read the TCPIP V5.5 release notes.

It says, SSH, SFTP, and SCP commands may not work correctly with sys$input, sys$output, and sys$error devices in batch mode. and it may send unexpected characters to the output files here and there.

Try directing output to any files.
$ assign xxx.dat sys$output.


Archunan
Regards
Archie
Gerhard Olsson
Advisor

Re: SSH remote command execution fails from batchmode

I have read the Release Notes and since ECO5 SSH mostly works according to the notes. There are number of limitations still, but I can get around them. SSH execution on the OpenVMS side seems to be working.

The problem in this situation is that SSH seems to identify itself differently on the _remote_ side when running in batch mode. Since it is working from interactive mode (even when I specify BatchMode), the implementation on the Solaris side is not completely broken.

Gerhard
Arch_Muthiah
Honored Contributor

Re: SSH remote command execution fails from batchmode

Hi Gerhard,

The link below discuss about your SSH/Solaris issues?

They were talking about -b option with the batchfile to read the input from ( but with SFTP)

http://www.computing.net/unix/wwwboard/forum/7006.html


Archunan

Regards
Archie
Gerhard Olsson
Advisor

Re: SSH remote command execution fails from batchmode

The -b parameter for sftp is used to read commands (instead of reading from std input). Not really related to this problem.

Regarding the link: SSH in OpenVMS will disable all password based authentication methods if in batch mode (or option "BatchMode yes" is set as in my example).

Thanks for the hints though. I guess that what I am looking for is a way to get OpenVMS SSH to identify itself the same from interactive and batch mode.

A few more observations:
1.
If I do not allocate a pseudo terminal on the remote side "-t" parameter, the remote program fails also from Interactive mode.
$ ssh -o "BatchMode yes" testuser@10.1.2.57 "testscript parameter"

2.
If I call the Solaris program directly, it succeeds:
$ ssh -t -o "BatchMode yes" testuser@10.1.2.57 "OtherProg parameter"
(still not a workaround, the script performs some inititialations before the prog).
Gerhard Olsson
Advisor

Re: SSH remote command execution fails from batchmode

When logging in from batch mode SSH will not read login files on the remote host.

In my case, /etc/profile (remote user is bash) is not read and the standard environment variables are therefore not available and the remote program fails.

I can fix this on the Solaris side, so it is not a major issue for me. Still something to be aware of.