[opensuse] Help with ssh_config
This is kind of driving me nuts, so I was hoping that someone might have some insights. I've got a cron'd script that's being called on a box, that runs a command like this: /usr/bin/sftp -v -b /home/jobsub/xgsftp_0518181327.parm -F /opt/ssh/ssh_config ftppub@ftp.xyz.com >> /home/jobsub/sftp_log_0518181327.log 2>&1 The contents of the .parm file are: lcd /home/jobsub cd / put file.txt bye The relevant contents of my ssh_config file are: Host ftp.xyz.com PubkeyAuthentication yes PasswordAuthentication no UserKnownHostsFile=/dev/null StrictHostKeyChecking=no IdentityFile /opt/ssh/sftp_xyz_key If I try to run that command manually, it works, and the file is transferred successfully: OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /opt/ssh/ssh_config debug1: Applying options for ftp.xyz.com debug1: Connecting to ftp.xyz.com [1.2.3.4] port 22. debug1: Connection established. debug1: identity file /opt/ssh/sftp_xyz_key type 1 debug1: identity file /opt/ssh/sftp_xyz_key-cert type -1 debug1: Remote protocol version 2.0, remote software version CerberusFTPServer_9.0 debug1: no match: CerberusFTPServer_9.0 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-sha1 none debug1: kex: client->server aes128-ctr hmac-sha1 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY Warning: Permanently added 'ftp.xyz.com,1.2.3.4' (RSA) to the list of known hosts. debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering public key: /opt/ssh/sftp_xyz_key debug1: Server accepts key: pkalg ssh-rsa blen 533 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: Sending subsystem: sftp sftp> lcd /home/jobsub sftp> cd / sftp> put file.txt Uploading file.txt to /file.txt sftp> bye debug1: channel 0: free: client-session, nchannels 1 debug1: fd 0 clearing O_NONBLOCK Transferred: sent 3496, received 2944 bytes, in 0.5 seconds Bytes per second: sent 7193.1, received 6057.3 debug1: Exit status -1 However, if I try to do it through the cron job, it fails: OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 debug1: Reading configuration data /opt/ssh/ssh_config debug1: Connecting to ftp.xyz.com [1.2.3.4] port 22. debug1: Connection established. debug1: identity file /home/user/.ssh/id_rsa type 1 debug1: identity file /home/user/.ssh/id_rsa-cert type -1 debug1: identity file /home/user/.ssh/id_dsa type -1 debug1: identity file /home/user/.ssh/id_dsa-cert type -1 debug1: identity file /home/user/.ssh/id_ecdsa type -1 debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version CerberusFTPServer_9.0 debug1: no match: CerberusFTPServer_9.0 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-sha1 none debug1: kex: client->server aes128-ctr hmac-sha1 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY Host key verification failed. Couldn't read packet: Connection reset by peer For some reason, it's reading the ssh_config file, but doesn't link things up when run through a cron job? I've tried also setting the ssh_config match up with wildcards and by IP address too, but the results are the same. Any thoughts as to what's going on?? Oh, and -- there are other host configurations in the same ssh_config file, called in the same way, that work perfectly fine. It's just this one host entry that for some reason isn't matching up. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
This is kind of driving me nuts, so I was hoping that someone might have some insights.
I've got a cron'd script that's being called on a box, that runs a command like this:
/usr/bin/sftp -v -b /home/jobsub/xgsftp_0518181327.parm -F /opt/ssh/ssh_config ftppub@ftp.xyz.com >> /home/jobsub/sftp_log_0518181327.log 2>&1
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY Host key verification failed. Couldn't read packet: Connection reset by peer ... For some reason, it's reading the ssh_config file, but doesn't link things up when run through a cron job? I've tried also setting the ssh_config match up with wildcards and by IP address too, but the results are the same.
Any thoughts as to what's going on??
Oh, and -- there are other host configurations in the same ssh_config file, called in the same way, that work perfectly fine. It's just this one host entry that for some reason isn't matching up.
I've dealt with similar things, but I'm not at home where I experienced this, so I'm working from memory. That being said, I think that you need to look at changing 'PermitUserEnvironment' to 'yes' in /etc/ssh/sshd_config. -Nick -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 18/05/18 04:09 PM, Nick LeRoy wrote:
That being said, I think that you need to look at changing 'PermitUserEnvironment' to 'yes' in /etc/ssh/sshd_config.
I think that's it. This came up within the last eyar if you want to search the archives and I think the resolution was that the environment of a cron job is different from that of the CLI. Is this what resolves it? -- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
Anton Aylward
-
Christopher Myers
-
Nick LeRoy