• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

Ansible 서버에서 Windows 호스트 접속 문제

22.11.05 17:58 작성 조회수 760

0

윈도우 환경이고, 도커데스크탑을 이용해서 강의 진행중입니다.

Ansible에서 Kubernetes 제어하기 강의 내용에서 문제가 생겨서 문의글 남깁니다.

Ansible-Server에서 ssh keygen 생성 후 ssh-copy-id 윈도우계정@윈도우호스트IP 입력.

윈도우 호스트의 C드라이브/Users/윈도우계정/.ssh 하위에 authorized_keys에 Ansible-Server의 공개키를 복사해 두었습니다.

ssh 윈도우계정@윈도우아이피로 접속시에 계속해서 패스워드를 묻는 창이 뜨는데요, 해결 방법이 있는지 궁금합니다.

ssh -v 윈도우계정@윈도우아이피 입력시 출력창

 

OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf

debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config

debug1: configuration requests final Match pass

debug1: re-parsing configuration

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf

debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config

debug1: Connecting to 192.168.0.33 [192.168.0.33] port 22.

debug1: Connection established.

debug1: identity file /root/.ssh/id_rsa type 0

debug1: identity file /root/.ssh/id_rsa-cert type -1

debug1: identity file /root/.ssh/id_dsa type -1

debug1: identity file /root/.ssh/id_dsa-cert type -1

debug1: identity file /root/.ssh/id_ecdsa type -1

debug1: identity file /root/.ssh/id_ecdsa-cert type -1

debug1: identity file /root/.ssh/id_ed25519 type -1

debug1: identity file /root/.ssh/id_ed25519-cert type -1

debug1: identity file /root/.ssh/id_xmss type -1

debug1: identity file /root/.ssh/id_xmss-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_8.0

debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.1

debug1: match: OpenSSH_for_Windows_8.1 pat OpenSSH* compat 0x04000000

debug1: Authenticating to 192.168.0.33:22 as '82102'

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: algorithm: curve25519-sha256

debug1: kex: host key algorithm: ecdsa-sha2-nistp256

debug1: kex: server->client cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none

debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: <implicit> compression: none

debug1: kex: curve25519-sha256 need=32 dh_need=32

debug1: kex: curve25519-sha256 need=32 dh_need=32

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

debug1: Server host key: ecdsa-sha2-nistp256 SHA256:aeCMaeYYVSVWrcf7SWUB7C2RRkMH3SMT0wFDi0Gl8Og

debug1: Host '192.168.0.33' is known and matches the ECDSA host key.

debug1: Found key in /root/.ssh/known_hosts:1

debug1: rekey out after 4294967296 blocks

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: rekey in after 4294967296 blocks

debug1: Will attempt key: /root/.ssh/id_rsa RSA SHA256:P0l3EmzgWKERm6r85A/GZ1shIV61KgQqSsADDKxLOLI

debug1: Will attempt key: /root/.ssh/id_dsa

debug1: Will attempt key: /root/.ssh/id_ecdsa

debug1: Will attempt key: /root/.ssh/id_ed25519

debug1: Will attempt key: /root/.ssh/id_xmss

debug1: SSH2_MSG_EXT_INFO received

debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>

debug1: SSH2_MSG_SERVICE_ACCEPT received

debug1: Authentications that can continue: publickey,password,keyboard-interactive

debug1: Next authentication method: publickey

debug1: Offering public key: /root/.ssh/id_rsa RSA SHA256:P0l3EmzgWKERm6r85A/GZ1shIV61KgQqSsADDKxLOLI

debug1: Authentications that can continue: publickey,password,keyboard-interactive

debug1: Trying private key: /root/.ssh/id_dsa

debug1: Trying private key: /root/.ssh/id_ecdsa

debug1: Trying private key: /root/.ssh/id_ed25519

debug1: Trying private key: /root/.ssh/id_xmss

debug1: Next authentication method: keyboard-interactive

debug1: Authentications that can continue: publickey,password,keyboard-interactive

debug1: Next authentication method: password

82102@192.168.0.33's password:

 

답변 1

답변을 작성해보세요.

0

안녕하세요, 이도원입니다.

Windows에서 SSH 서버를 활성화 하기 위해 Windows에 Openssh 서버를 설치하셔야 합니다. 올려주신 메시지를 봤을 때는 이미지 OpenSSH 서버는 설치되어 있는 것 같습니다만, 혹시 설치 전이라고 하시면 아래와 같은 명령어를 실행하여 설치하시고 방화벽 설정도 확인해 보시기 바랍니다. 아래 명령어는 관리자모드 Powershell에서 실행하시기 바랍니다.

  • OpenSSH 서버 설치

    • Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

  • OpenSSH 서버 실행

    • Start-Service sshd

  • 방화벽 설정 확인

    • Get-NetFirewallRule -Name OpenSSH-Server-In-TCP

 

다음은 마지막 방화벽 설정 확인 시 표시 되는 이미지 입니다. Enabled 속성이 True로 표시되면 사용하실 수 있는 상태입니다.

image

다음 작업을 진행하시기 전에 먼저, Windows 콘솔(CMD나 Powershell)에서 ssh client로 지금 설치한 OpenSSH Server에 접속되는지 확인해 보도록 합니다.

image

위 이미지에서 제 Windows 계정은 zitan이고 Windows Host IP는 192.168.0.11 입니다. Password는 Windows 계정의 암호를 입력하셔야 하는데, 이부분에서 PIN 번호를 사용하여 로그인 중이시라면, PIN 번호가 아닌 정확한 암호를 입력하셔야 하니 주의 하시기 바랍니다.

위 과정을 모두 실행 다음에는, anisble-server 컨테이너에서 ssh-keygen으로 키를 생성 후 ssh-copy-id 하셨을 때, 정상적으로 Widnows .ssh 폴더에 키 파일이 복사될 겁니다.

감사합니다.

추가로, 아래 게시글에서 ansible 설정도 참고하시기 바랍니다.

https://www.inflearn.com/questions/686434

감사합니다.