"debug1: read_passphrase: can't open /dev/tty: No such device or address" when trying to connect through SSH

38,095

Solution 1

What does ls -la /dev/tty show? Is it both world-readable and world-writeable?

$ ls -la /dev/tty

crw-rw-rw- 1 root tty 5, 0 Aug 23 20:58 /dev/tty

$

That is what you should see. If not, that's your problem.

Solution 2

I had this read_passphrase: can't open /dev/tty error when my private key was wrongly formatted - instead of many lines, it was passed as a one-liner, and you might have any other format issue like a forgotten "-" at the start or end, or something wrong at the end of the lines, like a missing newline format or an additional letter at the end of a line.

See Dockerfile: clone repo with passwordless private key. Errors: “authentication agent” or “read_passphrase: can't open /dev/tty” for more details, with the main idea from Add private key to ssh-agent in docker file, which again had the idea from Gitlab CI/Docker: ssh-add keeps asking for passphrase.

Share:
38,095

Related videos on Youtube

LukLed
Author by

LukLed

My name is Łukasz Ledóchowski. I am almost on daily basis with: ASP.NET MVC / Entity Framework / KendoUI ASP.NET WebApi / Angular.JS / CQRS PHP / Kohana / MySQL

Updated on September 18, 2022

Comments

  • LukLed
    LukLed almost 2 years

    I am trying to connect to my server using

    ssh [email protected] -vv
    

    I get

    debug1: read_passphrase: can't open /dev/tty: No such device or address
    

    error or just

    Permission denied, please try again.
    Permission denied, please try again.
    Permission denied (publickey,password).
    

    when I do not use the -vv option.

    /dev/tty file does exist. I am logged in as root, so I have access to it. tty command returns

    /dev/console
    

    I am remotely connected (using Putty) to the server, and I am trying to connect to that from another server. It is not a cron job. How can I solve the problem?

  • Luc
    Luc over 10 years
    mu /dev/tty was strangely with the "crw-------" rights. Changing to crw-rw-rw- fixed the thing. This is the first time I had to do that in my ubuntu installations. Why were the rights not the good ones ?
  • questionto42standswithUkraine
    questionto42standswithUkraine over 3 years
    Use chmod 666 /dev/tty to change to rw-rw-rw- rights.