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
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] 삭제
몇 마디 만하겠습니다