Operating System - OpenVMS
1755049 Members
3083 Online
108828 Solutions
New Discussion

Using SFTP in a batch job

 
SOLVED
Go to solution
David Froble
Occasional Advisor

Re: Using SFTP in a batch job

Some specifics:

My VMS system is the client, and I do not know the OS and such of the server.

I've produced private and public keys, and moved a copy of the public key to the remote server, using the directories Steven had already created in his testing.

I can now perform a SFTP connection without using password, and I can perform a SFTP connection using a batch file.

MANY THANKS TO STEVEN SCHWEDA FOR THE HELP AND EXAMPLES.

Working from my own user account, with it's default directory on the system disk, I get the following when executing the command file in a batch job.

-----------
C.COM
$ set verify
$
$ SFTP "-B" C.BAT fsrbi@209.172.179.22
------------
C.BAT
pwd
ls
ls "-R"
quit
------------
C.LOG
$ Set NoOn
$
$ VERIFY = F$VERIFY(F$TRNLNM("SYLOGIN_VERIFY"))
Performing SYS$MANAGER:SYLOGIN.COM ...
Performing [DFE]LOGIN.COM ....
$
$ SFTP "-B" C.BAT fsrbi@209.172.179.22
sftp> pwd
/
sftp> ls
Warning: Failed to set terminal mode to PASTHRU in sftp.
sftp> ls "-R"
Warning: Failed to set terminal mode to PASTHRU in sftp.
sftp> quit
DFE job terminated at 25-APR-2011 19:31:58.73
-----------

What I'm using:

BRYCE> tcpip show version

HP TCP/IP Services for OpenVMS Alpha Version V5.6
on an AlphaStation 200 4/233 running OpenVMS V8.3

BRYCE> sftp -v
Sftp2/SFTP2.C:4543: CRTL version (SYS$SHARE:DECC$SHARE ident) is: V8.3-00

SshFileCopy/SSHFILECOPY.C:1080: Making local connection.
Ssh2SftpServer/SSHFILEXFERS.C:1754: Received SSH_FXP_INIT
Ssh2SftpServer/SSHFILEXFERS.C:1799: version is 3
SshFileCopy/SSHFILECOPY.C:1019: Connection to local, ready to serve requests.
Sftp2/SFTP2.C:728: Connection ready.
SshReadLine/SSHREADLINE.C:3652: Initializing ReadLine...

So, first question, am I running some old stuff that doesn't work so well, and I need to get the latest TCPIP software?

Then the second issue. When I attempt to use the exact same files from a user account that has it's default directory on a disk other than the system disk, I can not perform an online SFTP, and of course not a batch job SFTP either.

$ SFTP "-B" C.BAT fsrbi@209.172.179.22
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=000000000000
0000, PC=00000000000EA240, PS=0000001B

Improperly handled condition, image exit forced.
Signal arguments: Number = 0000000000000005
Name = 000000000000000C
0000000000000000
0000000000000000
00000000000EA240
000000000000001B

Register dump:
R0 = 0000000000000000 R1 = 0000000000000014 R2 = 0000000000015E80
R3 = 0000000000000000 R4 = 0000000000874750 R5 = 000000000005AA40
R6 = 0000000000000001 R7 = 000000000005AA40 R8 = 0000000000000001
R9 = 0000000000000000 R10 = 0000000000000001 R11 = 0000000000000000
R12 = 0000000000000001 R13 = 0000000000507840 R14 = 0000000000877B80
R15 = 0000000000877D28 R16 = 0000000000000000 R17 = 00000000000615E0
R18 = 0000000000060C70 R19 = 0000000000000CF4 R20 = 0000000000015C78
R21 = 0000000000000000 R22 = 0000000000877E6A R23 = 0000000000000019
R24 = 0000000000021999 R25 = 0000000000000001 R26 = 00000000000FD918
R27 = 0000000000013EA0 R28 = 0000000000000000 R29 = 000000007AE56D50
Warning: child process (/sys$system/tcpip$ssh_ssh2) exited with code -10.B


%TCPIP-E-SSH_FC_ERROR, error in ssh file transfer operation

I've got no idea what is causing the access violation. I'm really hoping that SFTP can be used from a user account with it's default directory not on the system disk.
Steven Schweda
Honored Contributor

Re: Using SFTP in a batch job

> [...] I do not know the OS and such of the
> server.

It's in the "-v" diagnostic messages. (I
didn't make that stuff up.)

> [...] the directories Steven had already
> created in his testing.

The directories were already there. All I
added was the public key file.

> [...] the command file in a batch job.

But the SFTP batch file worked well enough
interactively? (It's a start.) As you can
see, I had no trouble both ways.

> BRYCE> tcpip show version
>
> HP TCP/IP Services for OpenVMS Alpha Version V5.6
> on an AlphaStation 200 4/233 running OpenVMS V8.3

> [...] am I running some old stuff

Yes. (Hardware, too, it seems.)

> that doesn't work so well, and I need to
> get the latest TCPIP software?

Probably. (Have you ever seen a bug-free
TCPIP kit?) Around here, for example:

ALP $ tcpip show version

HP TCP/IP Services for OpenVMS Alpha Version V5.6 - ECO 5
on a COMPAQ Professional Workstation XP1000 running OpenVMS V8.3

> BRYCE> sftp -v
> [...]

I did suggest 'SSH "-V"', didn't I?

ALP $ ssh "-V"
alp$dkc0:[sys0.syscommon.][sysexe]tcpip$ssh_ssh2.exe: SSH Secure Shell OpenVMS (
V5.5) 3.2.0 on COMPAQ Professional Workstation - VMS V8.3

With hobbyist patch access having been
extinguished, I can't say what's current, but
five (or more) ECOs behind is generally not a
happy place to be.

> I've got no idea what is causing the access
> violation.

Usually, it's bad software, and yours is old
(so probably bad).

> [...] I'm really hoping that SFTP can be
> used from a user account with it's default
> directory not on the system disk.

My examples showing the prompt "alp $ " were
run from my personal account. (My SYS$LOGIN
is on the system disk, but wouldn't expect
that to matter.)

And that's "its default directory".