티스토리 뷰
반응형
테스트겸 도커에 ubuntu 리눅스 서버를 올려보았다.
이런저런 테스트 하던 중에 외부에서 ssh 접근이 잘되나 확인 해보니 되질 않았다.
(당연히 안되겠지 암것도 설치가 안되어 있을 텐데...)
ssh 접속을 위해 아래 것들을 설치해줍니다.
apt-get install passwd
apt-get install net-tools
apt-get install openssh-server
설치가 완료되면 ssh 를 실행시켜줍니다.
아래와 같이 잘 작동하는 것을 확인!
root@1cac234dfe99:/# service ssh start
* Starting OpenBSD Secure Shell server sshd [OK]
root@1cac234dfe99:/# service ssh status
* sshd is running
ssh가 잘 작동하니 리눅스 내에서 접근이 되나 시도해봤더니 root 로의 접근이 막혀있는 것을 확인하였다.
root@1cac234dfe99:/# ssh root@localhost -p22
root@localhost's password:
Permission denied, please try again.
/etc/ssh/sshd_config 에 수정이 필요하다
PermitRootLogin yes 추가
PasswordAuthentication yes 추가
vi /etc/ssh/sshd_config
...
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#StrictModes yes
...
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
...
그럼 이제 우분투 서버내에서 22번 포트로 ssh가 열리는 것을 확인할 수 있고,
외부에서 PuTTY로 접근을 시도해보았다.
8022:22 로 포트를 열어줬기 때문에 localhost:8022 로 접근이 되어야 한다.
그런데 말입니다....
내가 기존에 쓰고 있는 putty 에서 안되는 것을 확인...
알아보니 인증서관련 오류라서 putty 버전 업을 하라는 것을 알고 현재 최신 릴리즈를 다운 받았다.
잘되는 것을 확인하였고, 외부에서도 접근이 잘되었다.
* 외부에서 안될 시 방화벽을 꼭 확인하세요!
반응형
'DevOps > Docker' 카테고리의 다른 글
[Docker] 도커이미지 Hub에 푸시(push)하기 (0) | 2024.02.14 |
---|---|
[Docker] Dockerfile로 springboot jar 이미지 생성하기. (0) | 2023.09.01 |
[Docker] Container vi 설치 (0) | 2023.01.26 |
댓글