как использовать Net::SSH::Perl с открытыми ключами?

Я пытаюсь использовать Net::SSH::Perl для подключения с использованием открытых ключей с этим кодом:

my $ssh = Net::SSH::Perl->new($host, debug=>1) || die ......

Я поместил ключ в /root/.ssh/id_rsa и /root/.ssh/identity

Кажется, что он не пытается использовать открытый ключ и вместо этого пытается запросить пароль:

Я получаю этот вывод:


localhost: Sent key-exchange init (KEXINIT), wait response.
localhost: Algorithms, c->s: 3des-cbc hmac-sha1 none
localhost: Algorithms, s->c: 3des-cbc hmac-sha1 none
localhost: Entering Diffie-Hellman Group 1 key exchange.
localhost: Sent DH public key, waiting for reply.
localhost: Received host key, type 'ssh-dss'.
localhost: Host '10.212.1.201' is known and matches the host key.
localhost: Computing shared secret key.
localhost: Verifying server signature.
localhost: Waiting for NEWKEYS message.
localhost: Send NEWKEYS.
localhost: Enabling encryption/MAC/compression.
localhost: Sending request for user-authentication service.
localhost: Service accepted: ssh-userauth.
localhost: Trying empty user-authentication request.
localhost: Authentication methods that can continue: publickey,gssapi-with-mic,password.
localhost: Next method to try is publickey.
localhost: Next method to try is password.
localhost: Trying password authentication.
localhost: Will not query passphrase in batch mode.
localhost: Authentication methods that can continue: publickey,gssapi-with-mic,password.
localhost: Next method to try is publickey.
localhost: Next method to try is password.
localhost: Trying password authentication.
localhost: Will not query passphrase in batch mode.
localhost: Authentication methods that can continue: publickey,gssapi-with-mic,password.
localhost: Next method to try is publickey.
localhost: Next method to try is password.
localhost: Trying password authentication.
localhost: Will not query passphrase in batch mode.
localhost: Authentication methods that can continue: publickey,gssapi-with-mic,password.
localhost: Next method to try is publickey.
localhost: Next method to try is password.
7
задан Arthur Ulfeldt 26 August 2010 в 18:18
поделиться

1 ответ

нашел: нужно указать местоположение файла ключа вручную:

@KEYFILE = ("/root/.ssh/id_rsa");
$ssh = Net::SSH::Perl->new($host, debug=>1, identity_files=>\@KEYFILE)
11
ответ дан 6 December 2019 в 22:59
поделиться
Другие вопросы по тегам:

Похожие вопросы: