Use X SSH key when logging in to Y remote user?

user2248259

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?

user2248259

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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

SSH remote user need to be logged in?

분류에서Dev

SSH key authentication with another user

분류에서Dev

SSH key authentication with another user

분류에서Dev

How to ssh to remote server using a private key?

분류에서Dev

ssh key exists on remote, but still prompts for password?

분류에서Dev

SSH to access remote screen without X

분류에서Dev

Strange nodejs behaviour when logging in a user

분류에서Dev

how to use emacs tramp with ssh remote to server

분류에서Dev

How to deny root SSH login + require SSH key for user?

분류에서Dev

multiple users remote access using ssh key based authentication

분류에서Dev

How to configure ssh to use different key?

분류에서Dev

Howto force ssh to use a specific private key?

분류에서Dev

User and host names in the public key on ssh-copy-id

분류에서Dev

Why is SSH key authentication failing for this user? (CENTOS 7)

분류에서Dev

Global SSH key, working for root user but not for other users

분류에서Dev

Os X에서 "ssh -Y"사용

분류에서Dev

Snap packages can't use my SSH key

분류에서Dev

Can't login to remote debian system with RSA key and ssh.exe from Cygwin

분류에서Dev

Identify SSH public key on remote end's shell session (no agent or no identities in agent)

분류에서Dev

Allow password authentication in SSH only when there is no key in authorized_keys

분류에서Dev

SSH key randomart image changed when setting up

분류에서Dev

Server, Remote Login, SSH?

분류에서Dev

Why do I need XDMCP to start a remote X session over SSH?

분류에서Dev

SSH not terminated after exit when there is X Forward program

분류에서Dev

can't login in new user via ssh 'server refused our key'

분류에서Dev

Logging in a user to a Web API application

분류에서Dev

What commands does git use when communicating via ssh?

분류에서Dev

SSH session hanging the remote desktop

분류에서Dev

Use scikit-learn to predict data vector "x" given "y"?

Related 관련 기사

  1. 1

    SSH remote user need to be logged in?

  2. 2

    SSH key authentication with another user

  3. 3

    SSH key authentication with another user

  4. 4

    How to ssh to remote server using a private key?

  5. 5

    ssh key exists on remote, but still prompts for password?

  6. 6

    SSH to access remote screen without X

  7. 7

    Strange nodejs behaviour when logging in a user

  8. 8

    how to use emacs tramp with ssh remote to server

  9. 9

    How to deny root SSH login + require SSH key for user?

  10. 10

    multiple users remote access using ssh key based authentication

  11. 11

    How to configure ssh to use different key?

  12. 12

    Howto force ssh to use a specific private key?

  13. 13

    User and host names in the public key on ssh-copy-id

  14. 14

    Why is SSH key authentication failing for this user? (CENTOS 7)

  15. 15

    Global SSH key, working for root user but not for other users

  16. 16

    Os X에서 "ssh -Y"사용

  17. 17

    Snap packages can't use my SSH key

  18. 18

    Can't login to remote debian system with RSA key and ssh.exe from Cygwin

  19. 19

    Identify SSH public key on remote end's shell session (no agent or no identities in agent)

  20. 20

    Allow password authentication in SSH only when there is no key in authorized_keys

  21. 21

    SSH key randomart image changed when setting up

  22. 22

    Server, Remote Login, SSH?

  23. 23

    Why do I need XDMCP to start a remote X session over SSH?

  24. 24

    SSH not terminated after exit when there is X Forward program

  25. 25

    can't login in new user via ssh 'server refused our key'

  26. 26

    Logging in a user to a Web API application

  27. 27

    What commands does git use when communicating via ssh?

  28. 28

    SSH session hanging the remote desktop

  29. 29

    Use scikit-learn to predict data vector "x" given "y"?

뜨겁다태그

보관