I'm looking for a way to set a specific SSH key while logging to a remote host with a particular username. Is this possible within the SSH config file?
For example:
Use key "id_rsa-test" for username "testuser":
ssh testuser@host1
ssh testuser@host2
ssh testuser@host3
Use key "id_rsa" for all other users.
ssh root@host1
ssh admin@host2
ssh [email protected]
Is there a way to configure this?
Thank you @xhienne (comment link) for your suggestion.
Adding the following to ssh_config appears to have solved the problem:
Match User testuser
IdentityFile ~/.ssh/id_rsa-test
This block should be placed above Host *
to send id_rsa-test
ahead of id_rsa
for testuser.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다