VSCODE SSH서버 무한 로그인 해결

최가윤·2023년 7월 19일
1
post-thumbnail

상황

  • VSCODE를 이용해 SSH서버(Linux)에 접속할 때, 비밀번호를 입력해도 로그인이 되지 않고 다시 비밀번호 입력창이 뜬다
  • Windows Powershell이나 CMD 등으로 SSH서버에 접속하면 정상적으로 로그인이 된다


원인

무한 로그인 현상의 원인은 다양한데, 내 경우에는 로컬의 문제보다는 SSH서버와 VSCODE 사이에 문제가 있었던 걸로 추정된다. 로컬에서 known_hosts, ssh_configure, key 등을 조작해도 해결이 되지 않았다.


해결방안

  1. VSCODE 켜기
  2. F1 -> Remote-SSH: Uninstall VS Code Server from Host... 선택
  3. 로그인 실패한 서버 선택
  4. VSCODE로 SSH서버 재접속



Why?

이 오류는 유명해서 여러 블로그에서 해결 방법을 알려주고 있는데 정확히 Uninstall이 무슨 역할을 하는지 기재하는 곳은 찾아보기 어려웠다. 도대체 왜 해결이 되는걸까? 찾고 찾다 VSCODE 공식 홈페이지에 들어가본 결과, 다음과 같은 내용을 찾을 수 있었다.

Cleaning up the VS Code Server on the remote
The SSH extension provides a command for cleaning up the VS Code Server from the remote machine, Remote-SSH: Uninstall VS Code Server from Host.... The command does two things: it kills any running VS Code Server processes and it deletes the folder where the server was installed.

If you want to run these steps manually, or if the command isn't working for you, you can run a script like this:

# Kill server processes
kill -9 $(ps aux | grep vscode-server | grep $USER | grep -v grep | awk '{print $2}')

# Delete related files and folder
rm -rf $HOME/.vscode-server # Or ~/.vscode-server-insiders

The VS Code Server was previously installed under ~/.vscode-remote so you can check that location too.
https://code.visualstudio.com/docs/remote/troubleshooting

번역하자면 Uninstall은
1. 현재 SSH서버에서 실행 중인 VSCODE Server Process를 Kill
2. SSH서버가 설치된 폴더를 삭제한다

즉, SSH서버에서 ~/.vscode-server 파일을 지우는 것과 Uninstall이나 같은 역할을 한다.

profile
Study AI (2022 - )

0개의 댓글