LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SFTP fails public key authentication in batch mode (https://www.linuxquestions.org/questions/linux-newbie-8/sftp-fails-public-key-authentication-in-batch-mode-882902/)

chicagovol 05-26-2011 02:54 PM

SFTP fails public key authentication in batch mode
 
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?

chicagovol 05-26-2011 03:52 PM

So simple it's stupid
 
I had mistyped the username in the batch mode script.

You lose your focus for just a minute...:rolleyes:


All times are GMT -5. The time now is 05:06 PM.