docker gitlab-ci ssh php-web, get read_passphrase:

ssh调试显示


debug1: Next authentication method: publickey

debug1: Offering public key: /dev/fd/63 RSA SHA256:xxxxxxxxxxxxxxxxxx agent

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password

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: 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,gssapi-keyex,gssapi-with-mic,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,gssapi-keyex,gssapi-with-mic,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,gssapi-keyex,gssapi-with-mic,password

debug1: No more authentication methods to try.

xxxxxxx@xxxxxxxx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

lost connection

gitlab-ci.yml


stages:

  - deploy

before_script:

  - echo "ssh-user:$SSH_USER"

  - echo "ssh-host:$SSH_HOST"

  - echo "ci-pro-dir:$CI_PROJECT_DIR"

  - export PATH=/usr/local/bin:$PATH

  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'

  - eval $(ssh-agent -s)

  - ssh-add <(echo "$SSH_PRIVATE_KEY")

  - mkdir -p ~/.ssh

  - chmod 700 ~/.ssh

  - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts

  - chmod 644 ~/.ssh/known_hosts

  - '[[ -f /.dockerenv ]] && echo -e "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > ~/.ssh/config'

使用 ssh 到 scp 文件文件夹,但显示 read_passphrase: can't open /dev/tty: No such device or address


存在“/dev/tty”


不知道如何解决,我应该删除“/dev/tty”并重建它吗?


POPMUISE
浏览 179回答 3
3回答

慕沐林林

已经试过了,还是不行。公钥已放入 authorized_keys,私钥已通过使用的变量发送到 ssh-agent$ scp -o StrictHostKeyChecking=no -v -r $CI_PROJECT_DIR $SSH_USER@$SSH_HOST:$SERVER_PATHExecuting: program /usr/bin/ssh host xxx.xx.xxx.xxx, user root, command scp -v -r -t /home/dnmp/www/icitysecret_backendOpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d&nbsp; 10 Sep 2019debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 19: Applying options for *debug1: Connecting to xxx.xx.xxx.xxx [xxx.xx.xxx.xxx] port 22.debug1: Connection established.debug1: identity file /root/.ssh/id_rsa type -1debug1: identity file /root/.ssh/id_rsa-cert type -1debug1: identity file /root/.ssh/id_dsa type -1debug1: identity file /root/.ssh/id_dsa-cert type -1debug1: identity file /root/.ssh/id_ecdsa type -1debug1: identity file /root/.ssh/id_ecdsa-cert type -1debug1: identity file /root/.ssh/id_ed25519 type -1debug1: identity file /root/.ssh/id_ed25519-cert type -1debug1: identity file /root/.ssh/id_xmss type -1debug1: identity file /root/.ssh/id_xmss-cert type -1debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002debug1: Authenticating to xxx.xx.xxx.xxx:22 as 'root'debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: algorithm: curve25519-sha256debug1: kex: host key algorithm: ecdsa-sha2-nistp256debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: expecting SSH2_MSG_KEX_ECDH_REPLYdebug1: Server host key: ecdsa-sha2-nistp256 SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxWarning: Permanently added 'xxx.xx.xxx.xxx' (ECDSA) to the list of known hosts.debug1: rekey after 134217728 blocksdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: rekey after 134217728 blocksdebug1: Will attempt key: root@xxxxxxxxxxxxxx RSA SHA256:xxxxxxxxxxxxxxxxxxx agentdebug1: Will attempt key: /root/.ssh/id_rsa&nbsp;debug1: Will attempt key: /root/.ssh/id_dsa&nbsp;debug1: Will attempt key: /root/.ssh/id_ecdsa&nbsp;debug1: Will attempt key: /root/.ssh/id_ed25519&nbsp;debug1: Will attempt key: /root/.ssh/id_xmss&nbsp;debug1: SSH2_MSG_EXT_INFO receiveddebug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>debug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Next authentication method: gssapi-keyexdebug1: No valid Key exchange contextdebug1: Next authentication method: gssapi-with-micdebug1: Unspecified GSS failure.&nbsp; Minor code may provide more informationNo Kerberos credentials available (default cache: FILE:/tmp/krb5cc_0)debug1: Unspecified GSS failure.&nbsp; Minor code may provide more informationNo Kerberos credentials available (default cache: FILE:/tmp/krb5cc_0)debug1: Next authentication method: publickeydebug1: Offering public key: root@xxxxxxxxxxxxxxxxx RSA SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxx agentdebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Trying private key: /root/.ssh/id_rsadebug1: Trying private key: /root/.ssh/id_dsadebug1: Trying private key: /root/.ssh/id_ecdsadebug1: Trying private key: /root/.ssh/id_ed25519debug1: Trying private key: /root/.ssh/id_xmssdebug1: Next authentication method: passworddebug1: read_passphrase: can't open /dev/tty: No such device or addressdebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passwordPermission denied, please try again.debug1: read_passphrase: can't open /dev/tty: No such device or addressdebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passwordPermission denied, please try again.debug1: read_passphrase: can't open /dev/tty: No such device or addressdebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: No more authentication methods to try.root@xxx.xx.xxx.xxx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).lost connection

凤凰求蛊

您能否尝试从 shell 简单地通过 ssh 连接到主机?在这种情况下,我们将在不调试 gitlab-ci 的情况下查看 SSH 是否可行

PIPIONE

我会尝试下一个:1.首先生成公共/私人 rsa 密钥对。2.复制公钥作为authorized_key:cat&nbsp;~/.ssh/id_rsa.pub&nbsp;|&nbsp;ssh&nbsp;$SSH_USER@$SSH_HOST'cat&nbsp;>>&nbsp;~/.ssh/authorized_keys'
打开App,查看更多内容
随时随地看视频慕课网APP