read_passphrase: can't open /dev/tty: No such device or address
Asked by Dusan Schiffel:

How do I find out where the problem is? I can't move any further, even though I have the right configuration.

**/dev/tty** on remote server

```
root@kyle ~ # ls -la /dev/tty
crw-rw-rw- 1 root tty 5, 0 Aug 11 08:22 /dev/tty
```

```
INFO: Using passed SSH_KEY...
INFO: Adding known hosts...
INFO: Appending to ssh config file private key path
INFO: Applied file permissions to ssh directory.
Executing: program /usr/bin/ssh host 78.46.212.172, user cms, command scp -v -r -p -t /home/cms
OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 78.46.212.172 [78.46.212.172] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/pipelines_id type -1
debug1: identity file /root/.ssh/pipelines_id-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u3
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u3 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 0x04000002
debug1: Authenticating to 78.46.212.172:22 as 'cms'
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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:vwdKymSVIutzr7Z79SDWtp3XBut65h3S6OLbzXWt3a4
debug1: read_passphrase: can't open /dev/tty: No such device or address
Host key verification failed.
lost connection
? Deployment failed.
```


Answers:
author: Alberto Garc?a
body: Hi all, I know its an old issue but I have this exact issue and have no clue about how to solve it.

This is my tty content:

```
builder@tester:~/.ssh$ ls -la /dev/tty
crw-rw-rw- 1 root tty 5, 0 Nov 10 11:20 /dev/tty
```

And the pipeline error log:

```
INFO: Configuring ssh with default ssh key.
INFO: Adding known hosts...
INFO: Appending to ssh config file private key path
INFO: Applied file permissions to ssh directory.
Executing: program /usr/bin/ssh host $SERVER_IP, user $SERVER_USER, command scp -v -r -p -d -t /var/www/app/production/
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1k 25 Mar 2021
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to $SERVER_IP [$SERVER_IP] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/pipelines_id type -1
debug1: identity file /root/.ssh/pipelines_id-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to $SERVER_IP:22 as '$SERVER_USER'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:/rgEr9iCCuWlIa0c4TMdf689iC3TFAgGaX7jc+sQRZk
debug1: Host '$SERVER_IP' is known and matches the ED25519 host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /root/.ssh/pipelines_id explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/pipelines_id
debug1: Authentications that can continue: publickey,password
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.
$SERVER_USER@$SERVER_IP: Permission denied (publickey,password).
lost connection
? Deployment failed
```

I don't understand here why *dev/tty* throw *No such device or address* when builder user has access to it. And why it's asking for *read_passphrase,*I do not set any passphrase.

For the record, I fetched the public IP and put the repo public ssh key in authorized_keys in server.

Thank you in advance.


author: Kevin
body: I had the same issue. I solved this problem by

1. go to -\> Repository settings

2. go to -\> SSH keys ( on the left navigation)

3. at the known hosts section

- input your Bastion host public IP address

- then click Fetch button

- rerun your pipeline

![Screen Shot 2022-05-31 at 12.04.57 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/199869iD6F40FA0EAAC21F5/image-size/large?v=v2&px=999 "Screen Shot 2022-05-31 at 12.04.57 PM.png")


author: srivera
body: I got the same issue, lost already 3 hours looking for a solution.... anyone?


author: Nic Brough -Adaptavist-
body: Ok, this is about the build environment, not actually Bitbucket pipelines.

I can see you've checked /dev/tty is accessible to root on a machine, but have you checked it is accessible to the user cms on the build server?


Tags: atl-gruland

bitbucket-pipelines