LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2022, 10:28 AM   #1
linux_789
LQ Newbie
 
Registered: Apr 2021
Posts: 4

Rep: Reputation: Disabled
SSH to second server using SSH agent


I need to get to my second server (SVR2) using key pairs instead of password (Site policy). I use Putty on my windows laptop to SSH to the first server (SVR1) with no problem. The second server is remote and I cannot doing anything without successfully SSH to it. My user ID is user1 on both SVR1 and SVR2

On the putty session I specified "Allow agent forwarding". To SSH to SVR2, on SVR1, I entered
$ssh -v -A user1@SVR2.com, the output shows
(I cut off some output to reduce space, let me know if I cut off too much)
debug1: identity file /home/user1/.ssh/id_rsa type -1
:
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs.............
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/user1/.ssh/id_rsa
debug1: Trying private key: /home/user1/.ssh/id_dsa
debug1: Trying private key: /home/user1/.ssh/id_ecdsa
debug1: Trying private key: /home/user1/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

On SVR1 /home/user1/.ssh directory only has
-rw------- 1 ec2-user ec2-user 401 Jun 6 20:11 authorized_keys
-rw-r--r-- 1 ec2-user ec2-user 376 Jun 7 21:50 known_hosts

]$ eval $(ssh-agent)
Agent pid 2904
This shows that the SSH agent is running.

Please correct me if I am wrong. The last few lines of debug output seems that it is looking for private key in the directory. But I think one of the the purpose of using the SSH agent is not having to put my private key in the intermediate server.
Can you help me to understand what is leading to the "Permission denied (publickey)" error?

I think SVR2 has to have my public key. This is where I am also confused. How can I get my public key to SVR2 if I cannot SSH to it ?

Last edited by linux_789; 06-09-2022 at 10:40 AM.
 
Old 06-09-2022, 04:20 PM   #2
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
SSH to second server using SSH agent

man ssh-copy-id
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Puppet agent gives 500 error access denied using master/agent model AlanRaczek CentOS 3 03-21-2019 07:16 AM
[SOLVED] ssh-agent -> The agent has no identities. windstory Linux - Security 2 11-19-2008 06:45 PM
Error: Agent Configuration Agent (use Oracle with Linux) shipon_97 Linux - Enterprise 0 02-02-2007 12:11 AM
can't find ide.agent & block.agent for hotplug for 2.6 jg167 Linux - Newbie 1 06-23-2004 05:20 PM
Hotplug problems: RH 9, 2.6.6, PCMCIA-CS 3.2.7 (missing ide.agent & block.agent) jg167 Red Hat 1 06-23-2004 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration