I am attempting to set up an automatic transfer via sftp using public key authentication. I have created a public/private key pair to connect to the remote server without using a password. I have also been able to use this key pair to login from the command line: sftp -vvv -oPort=<server-side port> user@server.
Debug info from interactive command:
Code:
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/cdurbin/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: SHA1 fp 1d:77:ac:ab:54:aa:c9:6a:cd:64:44:12:ad:fc:b6:36:50:ce:18:c1
debug3: sign_and_send_pubkey
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
However, when I attempt to use sftp in batch mode, the authentication fails: sftp -vvv -b<batchfile> -oPort=<server-side port> user@server
Debug from failed authentication:
Code:
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/cdurbin/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey,password,keyboard-interactive).
Couldn't read packet: Connection reset by peer
Does anyone have any idea why it would work for one method but not the other?