Jenkins SSH远程主机无法连接到服务器

ygya80vv  于 2023-02-03  发布在  Jenkins
关注(0)|答案(1)|浏览(403)

我可以使用ssh密码和Jenkins bash的私钥访问目标,我使用相同的主机、用户和私钥在Jenkins上配置SSH站点,我得到下一个错误:

Docker日志:

2022-09-23 05:06:52.357+0000 [id=71]    SEVERE  o.j.h.p.SSHBuildWrapper$DescriptorImpl#doLoginCheck: Auth fail 2022-09-23 05:06:52.367+0000 [id=71] SEVERE  o.j.h.p.SSHBuildWrapper$DescriptorImpl#doLoginCheck: Can't connect to server

坞站-组合:

version: '3'
services:
  jenkins:
    container_name: jenkins
    image: jenkins/jenkins
    ports:
      - "8080:8080"
    volumes:
      - $PWD/jenkins_home:/var/jenkins_home
    networks:
      - net
  remote_host:
    container_name: remote-host
    image: remote-host
    build:
      context: fedora
      dockerfile: Dockerfile
    networks:
      - net
  db_host:
    container_name: db
    image: mysql:5.7
    environment:
      - "MYSQL_ROOT_PASSWORD=PASSWORD"
    volumes:
      - "$PWD/db:/var/lib/mysql"
    networks:
      - net
networks:
  net:

对接文件:

FROM fedora

RUN yum update -y

RUN yum -y install unzip

RUN yum -y install openssh-server

RUN useradd RemoteUser && \ 
  echo "RemoteUser:Password"| chpasswd && \
  mkdir /home/madchabelo/.ssh && \
  chmod 700 /home/madchabelo/.ssh

COPY remote-ki.pub /home/madchabelo/.ssh/authorized_keys

RUN chown madchabelo:madchabelo -R /home/madchabelo/.ssh/ && \
  chmod 600 /home/madchabelo/.ssh/authorized_keys

RUN ssh-keygen -A

RUN yum -y install mysql

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
    unzip awscliv2.zip  && \
    sudo ./aws/install

RUN yum -y install vim

CMD /usr/sbin/sshd -D

我尝试使用IP,得到相同的结果。
问候

ih99xse1

ih99xse11#

创建私钥时,应该在ubuntu 20. 04版本之后使用以下命令创建代码。
ssh-keygen -t ecdsa -m PEM -f远程密钥
有关更详细的说明,请参阅下面的链接:
https://community.jenkins.io/t/ssh-connection-auth-fail/4121/7

相关问题