기타/빅데이터 - Hadoop

ssh localhost 오류 # ssh: connect to host localhost port 22: Connection refused

둥굴둥굴둥굴레차 2021. 8. 24. 14:48

 

상황

아래 명령어는 SSH server가 잘 설치되어있는지 알아볼 수 있는 명령어다.

기본적으로는 시스템 자체에 원격접속을 시작할 수 있는 명령어다.

$ ssh localhost

난 다음과 같은 에러를 볼 수 있었다.

 

분석

이 에러를 얻었을 때의 의미는

  1. SSH server 패키지가 시스템에 설치가 되어있지 않거나
  2. 서비스가 그저 현재 활성화되지 않았을 때이다.

 

SSH service를 체크해보자.(나의 경우엔 1번 문제였다.)

$ systemctl status sshd

나와 같은 결과를 얻었다면 service를 찾을 수 없으니 설치해야한다는 의미다.

 

openssh-server패키지를 설치하자.

$ sudo apt-get install openssh-server

password를 입력해주고 다음 질문에도 Y표시를 해주자.

 

다시 SSH service를 체크해보니 active된 것을 볼 수 있다.

 

그리고 이제 다시 시스템 자체에 원격접속을 시작할 수 있는 명령어를 입력해보니 다음의 질문을 했다.

The authenticity of host 'localhost (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:Mi9lerENUHgJwljDMBufEkotJKcJtjt5Tx665+czCoY. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

이 것은 해당 호스트를 최초로 접속할 때 물어보는 질문이다.

매번 접속할 때 fingerprint로 접속할래? 아님 그냥 바로 접속할래? 를 물어보는 것이다.

난 그냥 Yes를 입력하여 fingerprint방식으로 접속하지 않도록 설정해주었다.

 

 

이 다음에 다시 ssh localhost 명령어를 입력해주었을 땐 다른 질문 없이 바로 Ubuntu가 환영해주었다!

 

 

🔽 REFERENCE

 

SSH Connection Refused (Causes & Solutions) - Like Geeks

In this tutorial, you will know causes for the SSH Connection Refused problem and soutions for all of them, step by step. Also, how to debug SSH connection.

likegeeks.com