Jump to content
funtoo forums
  • 0
walkerxk1

keychain did't work in crontab

Question

script as follows:

#!/bin/bash
eval `keychain --noask --eval id_rsa_2`
ssh -vvv 192.254.80.9 date

i run it manually, it works:

ssh 192.254.80.9 date
Tue Nov  6 03:13:08 UTC 2018

crontab as follows:

15 11 6 11 2 bash -x /home/walkerxk/conf/a.sh >&/home/walkerxk/conf/a.dbg

crontab log as follows:

debug2: key: /home/walkerxk/.ssh/id_rsa_2 (0x55c0eaf6e150)
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:ZfKfGXBW0BmGPoRg8rgpmSOgyHD9UZEpcpzhMdjUim0 /home/walkerxk/.ssh/id_rsa_2
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg rsa-sha2-512 blen 535
debug2: input_userauth_pk_ok: fp SHA256:ZfKfGXBW0BmGPoRg8rgpmSOgyHD9UZEpcpzhMdjUim0
debug3: sign_and_send_pubkey: RSA SHA256:ZfKfGXBW0BmGPoRg8rgpmSOgyHD9UZEpcpzhMdjUim0
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug2: no passphrase given, try next key
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
walker.xia@192.254.80.9: Permission denied (publickey).

i tried add ". ~/.keychain/ubuntu1-sh" before eval command,it did't work too.

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×