How to configure ssh to use different key?

Jason Croyle

Hello I am trying to figure out how to make ssh use a different key id. I can ssh into the server fine but if I have a script that is run with sudo privileges I get prompted for the password. I can get around this by copying my ssh keys into roots .ssh folder but I know there is a better way to do this I just can't seem to find the answer. Any suggestions would be greatly appreciated.

EDIT: I have already tried setting sudo to keep environmental variables ie. HOME

dirkt

Hello I am trying to figure out how to make ssh use a different key id.

Either use -i, or set up ~/.ssh/config to mention a certificate. The last one needs to happen in the HOME directory of the current user.

I can ssh into the server fine but if I have a script that is run with sudo privileges I get prompted for the password

I agree with Kusalananda to (1) either switch back to the user, (2) don't run the whole script as sudo in the first place, but use sudo inside the script (which depends of course on what the script does, which you didn't tell us anything about).

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to configure Ubuntu 10.x to use a different window manager?

분류에서Dev

Howto force ssh to use a specific private key?

분류에서Dev

How to configure Django to Use mysql

분류에서Dev

How to use EGit with SSH on Windows?

분류에서Dev

How to effectively use screen and SSH?

분류에서Dev

How to ssh to remote server using a private key?

분류에서Dev

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

분류에서Dev

How do I configure ActiveJob to use Resque?

분류에서Dev

How do I configure Docker to use ZFS?

분류에서Dev

Snap packages can't use my SSH key

분류에서Dev

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

분류에서Dev

How can I tell how many bits my ssh key is?

분류에서Dev

how to use emacs tramp with ssh remote to server

분류에서Dev

How can I force SSH to give an RSA key instead of ECDSA?

분류에서Dev

SSH tunnel with different ssh port

분류에서Dev

How to configure DNN portals to use same username and password

분류에서Dev

how to configure wso2esb to use Saxon 9.8 HE

분류에서Dev

How do I use puppet to configure network settings?

분류에서Dev

How to use the value of another key in a sbt task?

분류에서Dev

How can I configure such that I can always SSH to my system over the internet on a dynamic IP?

분류에서Dev

How to configure an SFTP client Filezila to a machine which is accessible by doing SSH second time?

분류에서Dev

Fabric execute with SSH key?

분류에서Dev

How to use the Ubuntu One client to sync different folders to different accounts

분류에서Dev

How to use Query Builder when different conditions

분류에서Dev

How to use same entity in different relations in JPA?

분류에서Dev

How to use an editor template in different views

분류에서Dev

How to use different colors of Circles using JSON

분류에서Dev

How to use templated class in constructor for a different class

분류에서Dev

How to use different directory to serve static assets?

Related 관련 기사

  1. 1

    How to configure Ubuntu 10.x to use a different window manager?

  2. 2

    Howto force ssh to use a specific private key?

  3. 3

    How to configure Django to Use mysql

  4. 4

    How to use EGit with SSH on Windows?

  5. 5

    How to effectively use screen and SSH?

  6. 6

    How to ssh to remote server using a private key?

  7. 7

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

  8. 8

    How do I configure ActiveJob to use Resque?

  9. 9

    How do I configure Docker to use ZFS?

  10. 10

    Snap packages can't use my SSH key

  11. 11

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

  12. 12

    How can I tell how many bits my ssh key is?

  13. 13

    how to use emacs tramp with ssh remote to server

  14. 14

    How can I force SSH to give an RSA key instead of ECDSA?

  15. 15

    SSH tunnel with different ssh port

  16. 16

    How to configure DNN portals to use same username and password

  17. 17

    how to configure wso2esb to use Saxon 9.8 HE

  18. 18

    How do I use puppet to configure network settings?

  19. 19

    How to use the value of another key in a sbt task?

  20. 20

    How can I configure such that I can always SSH to my system over the internet on a dynamic IP?

  21. 21

    How to configure an SFTP client Filezila to a machine which is accessible by doing SSH second time?

  22. 22

    Fabric execute with SSH key?

  23. 23

    How to use the Ubuntu One client to sync different folders to different accounts

  24. 24

    How to use Query Builder when different conditions

  25. 25

    How to use same entity in different relations in JPA?

  26. 26

    How to use an editor template in different views

  27. 27

    How to use different colors of Circles using JSON

  28. 28

    How to use templated class in constructor for a different class

  29. 29

    How to use different directory to serve static assets?

뜨겁다태그

보관