# sshpass and /dev/tty problem



## yom (Jul 31, 2014)

Hello,

I know sshpass is an insecure way to use SSH or SFTP, but at the moment the company hosting the SFTP server won't allow me to use a public key (I don't understand why too...).

I'm currently trying to make sshpass work, but it seems I'm encountering some problem with /dev/tty while using it. Here is the command I'm using : `sshpass -p mypassword sftp -v -o PasswordAuthentication=yes -o StrictHostKeyChecking=no sftp.somecompany.urg`

And here is the output I'm getting from SFTP:


```
OpenSSH_6.4, OpenSSL 1.0.1e-freebsd 11 Feb 2013
debug1: Reading configuration data /home/yom/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to sftp.somecompany.urg [1.2.3.4] port 22.
debug1: Connection established.
debug1: identity file /home/yom/.ssh/id_rsa type 1
debug1: identity file /home/yom/.ssh/id_rsa-cert type -1
debug1: identity file /home/yom/.ssh/id_dsa type -1
debug1: identity file /home/yom/.ssh/id_dsa-cert type -1
debug1: identity file /home/yom/.ssh/id_ecdsa type -1
debug1: identity file /home/yom/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.4_hpn13v11 FreeBSD-20131111
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503
debug1: match: OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA ...
DNS lookup error: general failure
debug1: Host 'sftp.somecompany.urg' is known and matches the ECDSA host key.
debug1: Found key in /home/yom/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/yom/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /home/yom/.ssh/id_dsa
debug1: Trying private key: /home/yom/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: No more authentication methods to try.
Permission denied (publickey,keyboard-interactive).
Connection closed
```

/dev/tty is well there on my system :

```
ll /dev/tty
crw--w----  1 yom  tty  -  0x9c 31 jul 14:03 /dev/tty
```

My system is (with security patches compiled of course):

```
uname -r
10.0-RELEASE
```

And I know it's also not working on another server that is 9.2-RELEASE, and in a 8.4-RELEASE VM as well

Any advice please?


----------



## yom (Aug 7, 2014)

I think an answer to this thread is not important anymore for me. I've managed to get the server side to use a public ssh key.
Though, it seems so few people are using this "solution" and I understand perfectly well why. Still I think the port is broken and doesn't work out of the hat on every computer I've tried sshpass.


----------



## crowx (Jan 8, 2016)

Try to use the patch from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204823


----------

