Trying to setup co;Z Sftp

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
jack.weatherford
Posts: 21
Joined: Mon Aug 05, 2013 9:50 am

Trying to setup co;Z Sftp

Post by jack.weatherford »

I am attempting to setup a SFTP session with a zos 1.13 system.
I have followed the steps outlined in the manual but don't get the results expected.
When I connect to SFTP i see these messages:
16777269.: subsystem request for sftp
16777269.: debug1: subsystem: exec() /ifox/coz/bin/sftp-server.sh
16777269.: debug3: do_exec: subsystem 1
16777269.: debug3: do_exec: passwd name=IFXBJW, uid=0, gid=4, dir=/u/ifxbjw,
16777269.: debug3: do_exec_no_pty: no JSCBAUTH propagation to child
33554486.: debug3: zsshCloseOldDev: fd=-1
16777269.: debug2: fd 5 setting TCP_NODELAY
16777269.: debug2: fd 11 setting O_NONBLOCK
16777269.: debug2: fd 10 setting O_NONBLOCK
33554486.: debug3: zsshCloseOldDev: fd=-1
33554486.: debug1: permanently_set_uid: 0/4
33554486.: debug3: channel 0: close_fds r -1 w -1 e -1 c -1
but then from the SSH SHELL I enter the ls commands and get
ls /+mode=text
LS /+mode=text
listing complete for /+mode=text - does not exist

it appears that I am not getting to the COZ server
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Trying to setup co;Z Sftp

Post by dovetail »

Please post the contents of these files:

/etc/ssh/sftp-server.rc

HOME/.ssh/sftp-server.rc (if exists) for the userid that you are logging in to.

Also, what are the permission bits (mode) of these files?
jack.weatherford
Posts: 21
Joined: Mon Aug 05, 2013 9:50 am

Re: Trying to setup co;Z Sftp

Post by jack.weatherford »

#!/bin/sh
# Set site-wide environment variables for Co:Z SFTP server.
# Place this sample as an executable script in file: /etc/ssh/sftp-server.rc

# Uncomment the following to make CO:Z SFTP the default for all users
#USE_COZ_SFTP=true

# The following are the default locations for user level configuration files.
COZ_SFTP_USER_SERVER_RC=$HOME/.ssh/sftp-server.rc
#COZ_SFTP_USER_SERVER_CONFIG=$HOME/.ssh/cozsftp_server_config

and
#! /bin/sh
# Set user-specific environment variables for Co:Z SFTP server
# The presence of this executable script in $HOME/.ssh/sftp-server.rc
# will cause the COZ version of sftp-server to be used

# Uncomment and set the following options to override the defaults:
export SFTP_ZOS_OPTIONS="mode=text"
export SFTP_ZOS_INITIAL_DIR=//

# The Co:Z support team may request that you uncomment the following options
# to enable tracing:
export SFTP_SERVER_OPTIONS="-e -l debug3"
#export COZ_LOG=T

MODE for both are 755
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Trying to setup co;Z Sftp

Post by dovetail »

I don't see anything wrong in the .rc files.

I'm curious about this statement:

but then from the SSH SHELL I enter the ls commands and get
ls /+mode=text

What do you mean by the "SSH SHELL"?

This is an ls subcommand of some SFTP client.

You would need to log into Co:Z SFTP using an SFTP client, client PuTTY "psftp"

(From WIndows)
> psftp ifxbjw@myzos.com
psftp> ls /+
jack.weatherford
Posts: 21
Joined: Mon Aug 05, 2013 9:50 am

Re: Trying to setup co;Z Sftp

Post by jack.weatherford »

Possibly the wrong use of the phrase 'ssh shell'
I use REFLECTION FTP CLENT to login usng SFTP.
SFTP 192.168.75.68 ifxbjw
Reflection_14.1.389, SSH protocols 1.5/2.0, Reflection SSC Crypto Module 2.0.40

2016-05-23 13:49:04:400 debug3: Caller did not configure IPV4/IPV6
2016-05-23 13:49:04:400 debug3: Remote command sent to SSH server: sftp
2016-05-23 13:49:04:415 debug3: ROT Entry to find COM server: {DF830361-EF08-4129-AD4F-911A72DD76DE}14.1.3_192.168.75.68_ifxbjw@192.168.75.68:22._0
2016-05-23 13:49:04:415 debug3: Entering COM connection service critical section.
2016-05-23 13:49:04:415 debug3: Finding COM connection service.
2016-05-23 13:49:04:415 debug3: Connection not found for re-use ifxbjw@192.168.75.68:0 connection.
2016-05-23 13:49:04:415 debug3: Leaving COM connection service critical section.
2016-05-23 13:49:04:431 debug3: Entering COM connection service critical section.
2016-05-23 13:49:04:431 debug3: Creating COM connection service.
2016-05-23 13:49:04:534 debug3: Create new ifxbjw@192.168.75.68:0 connection.
2016-05-23 13:49:04:567 debug3: Leaving COM connection service critical section.
2016-05-23 13:49:04:583 debug1: Rhosts Authentication disabled, originating port will not be trusted.
2016-05-23 13:49:04:583 debug3: Configured for either ipv4 or ipv6 connections
2016-05-23 13:49:04:598 debug1: Attempting to connect via IPv4
2016-05-23 13:49:04:598 debug1: Connecting to 192.168.75.68 [192.168.75.68] port 22.
2016-05-23 13:49:04:598 debug1: (Server Address = 192.168.75.68:22)

2016-05-23 13:49:04:598 debug1: Creating an IPv4 socket
2016-05-23 13:49:04:783 debug1: Connection to 192.168.75.68:22 established.
2016-05-23 13:49:04:783 debug1: Exchange version identification
2016-05-23 13:49:05:200 debug1: Identification exchange received: SSH-2.0-OpenSSH_5.0

2016-05-23 13:49:05:200 debug1: Server vendor defaulting to a(n) OpenSSH server...
2016-05-23 13:49:05:200 debug1: Server style detected as UNIX.
2016-05-23 13:49:05:215 debug1: Server key style detected as OpenSSH.
2016-05-23 13:49:05:215 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.0
2016-05-23 13:49:05:215 debug1: match: OpenSSH_5.0 pat OpenSSH*
2016-05-23 13:49:05:215 debug1: Enabling compatibility mode for protocol 2.0
2016-05-23 13:49:05:231 debug2: SSH protocol version 2
2016-05-23 13:49:05:231 debug3: Status: Server version/ID SSH-2.0-OpenSSH_5.0

2016-05-23 13:49:05:231 debug1: Server protocol version SSH-2.0-OpenSSH_5.0

2016-05-23 13:49:05:232 debug1: Local version string SSH-2.0-Reflection_Windows_14.1.389
2016-05-23 13:49:05:232 debug1: Initializing PKI subsystem
2016-05-23 13:49:05:249 debug1: Query Manager: PKI: Using PKI configuration file: C:\Users\weatherford.jack\Documents\Attachmate\Reflection\.pki\pki_config
2016-05-23 13:49:05:252 debug1: Query Manager: PKI: Using Refleciton trust store file: C:\Users\weatherford.jack\Documents\Attachmate\Reflection\.pki\trust_store.p12
2016-05-23 13:49:05:269 debug1: Query Manager: PKI: Found Certificate cache file: C:\Users\weatherford.jack\Documents\Attachmate\Reflection\.pki\cert_cache
2016-05-23 13:49:05:284 debug1: Query Manager: PKI: Found CRL cache file: C:\Users\weatherford.jack\Documents\Attachmate\Reflection\.pki\crl_cache

then when I issue a ls /+ i see
listing complete for /+
.newoption=
clientcp=ISO8859-1
error.log
gdgnt
loglevel=I
mode=text
servercp=IBM-1047
trim

but then when attempting to issue the
ls /+mode=text (an example from the manual) i get
ls /+mode=text
LS /+mode=text
2016-05-23 13:56:33:876 debug3: absolute path: /+mode=text --> /+mode=text
2016-05-23 13:56:33:876 debug2: Sending SSH2_FXP_STAT "/+mode=text" (76)
2016-05-23 13:56:33:876 debug3: Sent message T:17 I:76
2016-05-23 13:56:34:110 debug3: Received stat reply T:105 I:76
2016-05-23 13:56:34:110 debug3: Attribs for /+mode=text : flags(4), size(0), uid(0), gid(0), perm(33206), atime(0), mtime(0)
2016-05-23 13:56:34:110 debug3: Sending SSH2_FXP_OPENDIR (77) //IFXBJW
2016-05-23 13:56:34:344 debug3: Sending SSH2_FXP_READDIR "" (78)
which basically tells me the documented ls /+ command is not working.
or am I wrong
jack.weatherford
Posts: 21
Joined: Mon Aug 05, 2013 9:50 am

Re: Trying to setup co;Z Sftp

Post by jack.weatherford »

and as a added thought
Putty doesn't work either. It gives me basically an FTP connection. and not SFTP.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Trying to setup co;Z Sftp

Post by dovetail »

I don't see anything wrong with the Reflection trace:

This:

ls /+

.newoption=
clientcp=ISO8859-1
error.log
gdgnt
loglevel=I
mode=text
servercp=IBM-1047
trim

shows the "settings" pseudo files in the pseudo "/+" directory.

This:
ls /+mode=text (an example from the manual) i get
ls /+mode=text
LS /+mode=text
2016-05-23 13:56:33:876 debug3: absolute path: /+mode=text --> /+mode=text
2016-05-23 13:56:33:876 debug2: Sending SSH2_FXP_STAT "/+mode=text" (76)
2016-05-23 13:56:33:876 debug3: Sent message T:17 I:76
2016-05-23 13:56:34:110 debug3: Received stat reply T:105 I:76
2016-05-23 13:56:34:110 debug3: Attribs for /+mode=text : flags(4), size(0), uid(0), gid(0), perm(33206), atime(0), mtime(0)
2016-05-23 13:56:34:110 debug3: Sending SSH2_FXP_OPENDIR (77) //IFXBJW
2016-05-23 13:56:34:344 debug3: Sending SSH2_FXP_READDIR "" (78)

The trace shows that mode=text setting was accepted. I am not sure where the extra "LS /+mode=text" line is coming from.
jack.weatherford
Posts: 21
Joined: Mon Aug 05, 2013 9:50 am

Re: Trying to setup co;Z Sftp

Post by jack.weatherford »

I see that I failed to paste the last line that concerned me.

listing complete for /+mode=text - does not exist

I get the "does not exist' after every ls /+ command even though as you pointed out the setting took.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Trying to setup co;Z Sftp

Post by dovetail »

I have no idea why Reflection is saying that "/+mode=text" is not found, since the trace shows that it was found.

Here is how you run PuTTY psftp:

Code: Select all

Windows> psftp -v myuser@myhost.com
Server version: SSH-2.0-OpenSSH_6.4
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Local:_Jun_23_2015_11:43:58
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-256
Host key fingerprint is:
ssh-rsa 2048 2b:6e:a8:88:49:7e:af:60:a6:0a:10:c9:3c:b4:c4:ce
Initialised AES-128 CBC client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-128 CBC server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Pageant is running. Requesting keys.
Pageant has 3 SSH-2 keys
Using username "myuser".
Trying Pageant key #0
Server refused our key
Trying Pageant key #1
Authenticating with public key "id_rsa" from agent
Sending Pageant's response
Access granted
Opening session as main channel
Opened main channel
Started a shell/command
Connected to myhost.com
Remote working directory is /u/myuser

psftp> ls /+
Listing directory /+
.newoption=
error.log
loglevel=I
mode=binary

psftp> ls /+mode=text
Listing directory /+mode=text
 mode=text
psftp> 

Post Reply