Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过SSH将gitlab runner(服务器)连接到虚拟机失败:权限被拒绝(公钥、密码)_Ssh_Gitlab_Gitlab Ci Runner_Openssh - Fatal编程技术网

通过SSH将gitlab runner(服务器)连接到虚拟机失败:权限被拒绝(公钥、密码)

通过SSH将gitlab runner(服务器)连接到虚拟机失败:权限被拒绝(公钥、密码),ssh,gitlab,gitlab-ci-runner,openssh,Ssh,Gitlab,Gitlab Ci Runner,Openssh,我尝试设置一个runner脚本,该脚本将通过SSH连接到VM(应用程序运行的地方)。在环境变量(CICD Config->Variables)中,我存储了用于连接到VM服务器的私钥(ed25519)。但随后出现以下错误消息。。有人知道怎么做吗?关于我可以检查以解决问题的可能问题的建议 下面是运行程序脚本.gitlab ci.yml和出现的错误消息 CI-RUNNER脚本 build_job: stage: build script: - apt-get update -y

我尝试设置一个runner脚本,该脚本将通过SSH连接到VM(应用程序运行的地方)。在环境变量(CICD Config->Variables)中,我存储了用于连接到VM服务器的私钥(ed25519)。但随后出现以下错误消息。。有人知道怎么做吗?关于我可以检查以解决问题的可能问题的建议

下面是运行程序脚本
.gitlab ci.yml
和出现的错误消息

CI-RUNNER脚本

build_job:
  stage: build
  script:
    - apt-get update -y
    - apt-get install openssh-client bash
    - mkdir ~/.ssh/
    - echo "$SSH_PRIVATE_KEY_CI_RUNNER" > ~/.ssh/id_ed25519
    - echo "$SSH_KNOWN_HOST_VM" > ~/.ssh/known_hosts
    - chmod -R 600 ~/.ssh/
 

    - ssh -v user@host -p 2222 "ls -a"
错误消息

debug1: Host '[server-address]:2222' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /root/.ssh/id_rsa 
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
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
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: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
user@serveradress: Permission denied (publickey,password).
ERROR: Job failed: exit code 1
debug1:Host'[server address]:2222'已知并与ECDSA主机密钥匹配。
debug1:在/root/.ssh/known_hosts中找到密钥:1
debug1:在134217728块之后重新键入
debug1:SSH2\u MSG\u已发送新密钥
debug1:应为SSH2\u MSG\u NEWKEYS
debug1:SSH2\u MSG\u接收到新密钥
debug1:在134217728块之后重新键入
debug1:将尝试密钥:/root/.ssh/id\u rsa
debug1:将尝试密钥:/root/.ssh/id\u dsa
debug1:将尝试密钥:/root/.ssh/id\u ecdsa
debug1:将尝试密钥:/root/.ssh/id_ed25519
debug1:将尝试键:/root/.ssh/id\u xmss
debug1:SSH2\u MSG\u EXT\u接收到信息
debug1:kex_输入_外部_信息:服务器信号algs=
debug1:SSH2\u消息\u服务\u接收
debug1:可以继续的身份验证:公钥、密码
debug1:下一个身份验证方法:公钥
debug1:正在尝试私钥:/root/.ssh/id\u rsa
debug1:正在尝试私钥:/root/.ssh/id\u dsa
debug1:正在尝试私钥:/root/.ssh/id\u ecdsa
debug1:正在尝试私钥:/root/.ssh/id_ed25519
debug1:可以继续的身份验证:公钥、密码
debug1:正在尝试私钥:/root/.ssh/id\u xmss
debug1:下一个身份验证方法:密码
debug1:读取\u密码短语:无法打开/dev/tty:没有此类设备或地址
debug1:可以继续的身份验证:公钥、密码
权限被拒绝,请重试。
debug1:读取\u密码短语:无法打开/dev/tty:没有此类设备或地址
debug1:可以继续的身份验证:公钥、密码
权限被拒绝,请重试。
debug1:读取\u密码短语:无法打开/dev/tty:没有此类设备或地址
debug1:可以继续的身份验证:公钥、密码
debug1:不再尝试验证方法。
user@serveradress:权限被拒绝(公钥、密码)。
错误:作业失败:退出代码1

要进行测试,请首先尝试使用不受密码保护的SSH私钥

这将避免“read_passphrase:can't open/dev/tty:No-this device或address”并验证密钥是否有效


这假设公钥已发布到“
host
~user/.ssh/authorized_keys
,并且ssh守护进程正在侦听端口2222。

要进行测试,请首先使用不受密码保护的ssh私钥

这将避免“read_passphrase:can't open/dev/tty:No-this device或address”并验证密钥是否有效

这假设公钥已发布到“
host
~user/.ssh/authorized_keys
,并且ssh守护进程正在侦听端口2222