Skip to content

Commit 6c85ab3

Browse files
Add an article that addresses ResolverError when connecting a ssh server in VS Code
1 parent cd68dbb commit 6c85ab3

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
layout: post
3+
title: "[MacOS] VS code에서 SSH 서버 연결할 때, Resolver Error 뜰 때 해볼만한 시도 하나"
4+
date: 2022-7-15 20:00
5+
categories: [Python]
6+
use_math: true
7+
comments: true
8+
---
9+
10+
터미널에서는 다음 명령으로 정상적으로 ssh 서버에 연결할 수 있는데, 유독 vs code의 `Remote - SSH`를 사용하여 접속할 때는 원격 서버에 연결할 수 없다는 에러에 봉착했습니다.
11+
12+
~~~bash
13+
ssh [USER]@[HOSTNAME] -p [PORT]
14+
~~~
15+
16+
<br>
17+
18+
"기타 작업"을 누른 후 출력에 보이는 메세지에서 몇몇 오류가 보였습니다. 전체 로그는 개인적인 정보가 많이 담겨 있어서 일부 오류만 적어놓았습니다.
19+
~~~bash
20+
[19:57:19.095] Running script with connection command: ssh -T -D 숫자 -o ConnectTimeout=15 <Host> bash
21+
[19:57:19.275] > /bin/sh: ssh: No such file or directory
22+
[19:57:19.276] Got some output, clearing connection timeout
23+
[19:57:19.523] "install" terminal command done
24+
[19:57:19.523] Install terminal quit with output: /bin/sh: ssh: No such file or directory
25+
[19:57:19.523] Received install output: /bin/sh: ssh: No such file or directory
26+
[19:57:19.523] Failed to parse remote port from server output
27+
[19:57:19.523] Resolver error: Error:
28+
at Function.Create (/어쩔/경로)
29+
at Object.t.handleInstallOutput (/어쩔/경로)
30+
at Object.t.tryInstall (/어쩔/경로)
31+
at processTicksAndRejections (/어쩔/경로)
32+
at async /어쩔/경로
33+
at async Object.t.withShowDetailsEvent (/어쩔/경로)
34+
at async Object.t.resolve (/저쩔/경로)
35+
at async /어쩔/경로
36+
[19:57:19.525] ------
37+
~~~
38+
39+
<br>
40+
41+
여러 시도를 해보았는데도 해결이 되지 않는다면, 저의 글이 해결책이 될 수도 있을 것 같습니다. 우선 `cmd` + `shift` + `p`를 누른 후 **setting**을 검색하여 **기본 설정: 설정 열기(JSON)**에 들어가서 다음과 같은 설정이 있는지 확인해줍니다.
42+
~~~
43+
"terminal.integrated.env.osx": {
44+
"PATH": ""
45+
},
46+
~~~
47+
48+
<br>
49+
50+
이 설정이 언제 왜 추가되었을까요? 바로 저의 이전 포스팅 [[MacOS] VS code 터미널에서 파이썬 인터프리터 설정 후에도 다른 경로의 파이썬을 실행하는 경우](https://hiddenbeginner.github.io/python/2022/03/16/vscode_terminal_does_not_point_python_of_virtual_envrionment.html)에서 추가해줬습니다. 하하.
51+
52+
<br>
53+
54+
위의 로그 메세지를 살펴보면 `/bin/sh: ssh: No such file or directory`가 있는데요. `sh`라는 것과 `ssh`의 경로를 못 찾고 있다는 말입니다. 터미널에서 다음을 실행하여 `sh``ssh`가 어디있는지 알아내야 합니다.
55+
~~~bash
56+
whcih sh
57+
which ssh
58+
~~~
59+
60+
<br>
61+
62+
저의 경우 `/bin/sh``/usr/bin/ssh`가 출력되었습니다. 녀석들이 있는 디렉토리를 `"PATH"`에 추가해주면 문제가 해결됩니다. 즉, `settings.json`에서 다음과 같이 수정해줍니다.
63+
~~~
64+
"terminal.integrated.env.osx": {
65+
"PATH": "/bin:/usr/bin"
66+
},
67+
~~~
68+
69+
<br>
70+
71+
이렇게 설정하시고 저장하시면, 원격 서버도 잘 접속되고, vs code 터미널에서 알맞은 인터프리터도 잘 찾아내게 됩니다. 이렇게 설정해서 발생하는 에러는 미래의 제가 해결해줄 것입니다.

0 commit comments

Comments
 (0)