I've got a script that needs to rsync some files to a remote machine. The rsync command looks like this:
rsync -avz -e 'ssh -vv -o IdentitiesOnly=yes -i /data/credentials/rsync2.key' \ --rsync-path="mkdir -p ~/new_data/12345/ && rsync" \ /data/new_data/ some_user@$REMOTE_HOST_IP:~/new_data/12345/
The output from the script looks like:
... debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug2: dh_gen_key: priv key bits set: 134/256 debug2: bits set: 505/1024 debug1: Server host key: RSA XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX debug1: read_passphrase: can't open /dev/tty: No such device or address Host key verification failed. rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]
It looks to me like ssh is trying to use a passphrase on the key. It shouldn't, the key doesn't require a passphrase. Also, I'm pretty sure that the message about
/dev/tty is not entirely accurate since my script confirms that
/dev/tty exists (
ls -l on it shows:
crw-rw-rw- 1 root root 5, 0 Feb 23 19:37 /dev/tty). I also know the keyfile is valid since I can manually connect to the remote host via ssh using the key.
The one catch here is that my script is running within a docker container and I'm not sure how that may affect rsync and ssh.