CozBatch fails rc=255 after being authenticated.

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
LeonBylsma
Posts: 22
Joined: Thu Apr 16, 2009 8:26 am

CozBatch fails rc=255 after being authenticated.

Post by LeonBylsma »

I'm sending data to a windows server (OpenSSH) from CoZBatch on Zos.
It fails on RC=255 and with debugging enabled I get the output below but no obvious reason for the failure. How do I find out why. I also have a trace log on the windows side (see bottom of this post):

CoZBatch.N.: Copyright (C) 2005-2009 Dovetailed Technologies LLC. All rights res
CoZBatch.N.: version 1.2.5 2009-04-20
CoZBatch.T.: <- setupEnvironment()
CoZBatch.T.: -> openDDs()
CoZBatch.D.: stdin file opened: //DD:STDIN
CoZBatch.D.: stdout file opened: //DD:STDOUT
CoZBatch.D.: stderr file opened: //DD:STDERR
CoZBatch.T.: <- openDDs()
CoZBatch.T.: -> logRegionSize()
CoZBatch.D.: region size requested = 0K, Actual below/above limit = 10216K / 127952K
CoZBatch.T.: <- logRegionSize()
CoZBatch.T.: -> setupProgname()
CoZBatch.D.: geteuid=921109991
CoZBatch.I.: executing progname=login-shell="-/bin/sh"
CoZBatch.T.: <- setupProgname(-/bin/sh)
CoZBatch.T.: -> spawnChild()
CoZBatch.D.: spawning progname=/bin/sh
CoZBatch.D.: argv.0. = -/bin/sh
CoZBatch.D.: current environment:
CoZBatch.D.: >LIBPATH=/lib:/usr/lib:.<
CoZBatch.D.: >_EDC_ADD_ERRNO2=1<
CoZBatch.D.: >HOME=/SYSR/u/ftp/ftpbatch<
CoZBatch.D.: >_BPX_SHAREAS=MUST<
CoZBatch.D.: >_BPX_SPAWN_SCRIPT=YES<
CoZBatch.D.: >_BPXK_JOBLOG=STDERR<
CoZBatch.D.: >PATH=/bin:/usr/bin<
CoZBatch.D.: spawned /bin/sh (33882742)
CoZBatch.T.: <- spawnChild()
CoZBatch.T.: -> copyChildStreams(fd_cin=1 fd_cout=2 fd_cerr=4)
CoZBatch.T.: fd_cin selected for writing
CoZBatch.T.: 65 byte line read from DD:STDIN
CoZBatch.T.: 65 bytes written to child stdin
CoZBatch.T.: fd_cin selected for writing
CoZBatch.T.: 17 byte line read from DD:STDIN
CoZBatch.T.: 17 bytes written to child stdin
CoZBatch.T.: fd_cin selected for writing
CoZBatch.T.: 10 byte line read from DD:STDIN
CoZBatch.T.: 10 bytes written to child stdin
CoZBatch.T.: fd_cin selected for writing
CoZBatch.T.: 33 byte line read from DD:STDIN
CoZBatch.T.: 33 bytes written to child stdin
CoZBatch.T.: fd_cin selected for writing
CoZBatch.T.: 4 byte line read from DD:STDIN
CoZBatch.T.: 4 bytes written to child stdin
CoZBatch.T.: fd_cin selected for writing
CoZBatch.T.: DD:STDIN EOF
CoZBatch.T.: fd_cerr selected for reading
CoZBatch.T.: 115 bytes written to DD:STDERR
CoZBatch.T.: fd_cerr selected for reading
CoZBatch.T.: 26 bytes written to DD:STDERR
CoZBatch.T.: fd_cerr selected for reading
CoZBatch.T.: child stderr output EOF
CoZBatch.T.: fd_cout selected for reading
CoZBatch.T.: child stdout output EOF
CoZBatch.T.: <- copyChildStreams()
CoZBatch.T.: -> waitChild()
CoZBatch.T.: <- waitChild()
CoZBatch.T.: <- run()
CoZBatch.I.: returning rc=exitcode=255
Co:Z sftp version: 1.2.5 (5.0p1) 2009-04-20
Copyright (C) Dovetailed Technologies, LLC. 2008. All rights reserved.
.00211. Connection closed

PS!!! This is my invocation parameters

//COZSFTP EXEC PGM=COZBATCH,
// REGION=0M,
// PARM='/-LT '
//SYSOUT DD SYSOUT=K < DTLSPAWN and system message
//STDENV DD DUMMY < can be used to set env vars
//STDOUT DD SYSOUT=K < spawned program STDOUT
//STDERR DD SYSOUT=K < spawned program STDERR
//SFTPI001 DD DSN=IFOB.LEON.CNTL(DAVIDTST),DISP=SHR
//STDIN DD *
/usr/local/coz/bin/cozsftp -b- wesb.sslsecure@41.208.19.53 <<EOB
lzopts mode=text
lzopts -a
put //DD:SFTPI001 LEONTST.txt
EOB
//

and this is the trace log on windows :
debug1: sshd version OpenSSH_3.8.1p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Server will not fork when running in debugging mode.
Connection from 196.22.217.6 port 2516
debug1: Client protocol version 2.0; client software version OpenSSH_3.8.1p1
debug1: match: OpenSSH_3.8.1p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user wesb.sslsecure service ssh-connection method n
one
debug1: attempt 0 failures 0
Failed none for wesb.sslsecure from 196.22.217.6 port 2516 ssh2
debug1: userauth-request for user wesb.sslsecure service ssh-connection method p
ublickey
debug1: attempt 1 failures 1
debug1: test whether pkalg/pkblob are acceptable
debug1: temporarily_use_uid: 6494/513 (e=400/401)
debug1: trying public key file /.ssh/authorized_keys
debug1: matching key found: file /.ssh/authorized_keys, line 2
Found matching DSA key: 93:21:42:a4:26:2b:39:3b:89:0b:68:96:3c:07:9d:66
debug1: restore_uid: (unprivileged)
Postponed publickey for wesb.sslsecure from 196.22.217.6 port 2516 ssh2
debug1: userauth-request for user wesb.sslsecure service ssh-connection method p
ublickey
debug1: attempt 2 failures 1
debug1: temporarily_use_uid: 6494/513 (e=400/401)
debug1: trying public key file /.ssh/authorized_keys
debug1: matching key found: file /.ssh/authorized_keys, line 2
Found matching DSA key: 93:21:42:a4:26:2b:39:3b:89:0b:68:96:3c:07:9d:66
debug1: restore_uid: (unprivileged)
debug1: ssh_dss_verify: signature correct
Accepted publickey for wesb.sslsecure from 196.22.217.6 port 2516 ssh2
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 0 win 131072 max 32768
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: init
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_channel_req: channel 0 request subsystem reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req subsystem
subsystem request for sftp
debug1: subsystem: exec() /usr/sbin/sftp-server
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 9168
debug1: session_exit_message: session 0 channel 0 pid 9168
debug1: session_exit_message: release channel 0
debug1: session_close: session 0 pid 9168
debug1: channel 0: free: server-session, nchannels 1
Connection closed by 196.22.217.6
debug1: do_cleanup
Closing connection to 196.22.217.6

And this was found in the windows event logs :

Following error appearing in Windows log:

**The description for Event ID ( 0 ) in Source ( sshd ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: sshd : PID 9900 : fatal: setreuid 6494: Permission denied.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

COZBATCH is the program used to run a shell in a batch job (a replacement for BPXBATCH). You have provided a trace for COZBATCH, but not for cozsftp, which is where the problem is. Was there a failure message from cozsftp in the //STDERR file?

Please add "-vvv" to the cozsftp command line in your batch job and post the trace.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I see now that you are getting a message from the client: "connection closed". A "-vvv" trace on the client may help, but the problem looks to be with sftp-server on the Windows box.

Have you tried to log into this Windows server using the same userid from another client (even ssh or putty from the same Windows machine)? Maybe there is something wrong with the Windows Openssh setup that is causing sftp-server to fail.

You might also need to get a trace for the Windows sftp-server. To do this, you can try adding the argument "-l DEBUG3" to the and of the sftp Subsystem configuration line in your Windows sshd_config file.
anmol77
Posts: 1
Joined: Sat Apr 23, 2016 4:36 am

Re: CozBatch fails rc=255 after being authenticated.

Post by anmol77 »

thanks for everything....
Post Reply