Google coral dev board: ssh connects first time, for every next attempt it shows permission denied(publickey)

3.3k views Asked by At

I have a google coral board manufactured on 1st February, 2019. I flushed the board with the latest Mendel Enterprise Day 4.0. I am using Ubuntu 19.04 desktop and tried to connect to the board via google's recommended Mendel Development Tool using mdt shell (mdt documentation here: https://coral.ai/docs/dev-board/mdt/), but it does not work (I have a separate question for that here:Cannot connect to coral dev board after updating to 4.0: mdt shell does not work, please answer if you can)

So I decided to use ssh and followed these sequantial steps:

  1. I already had ssh private and public key generated in my Ubuntu desktop
  2. I logged in to the board via serial port (screen /dev/ttyUSB0 115200), created $HOME/mendel/.ssh/authorized_keys with proper permission and copy pasted public key from local $HOME/.ssh/id_rsa.pub file to authorized_keys
  3. I tried ssh user@IP from terminal and it gave me the following error:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:hotsxb/qVi1/ycUU2wXF6mfGH++Yk7WYZv0r+tIhg4I. Please contact your system administrator. Add correct host key in /Users/scott/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /Users/scott/.ssh/known_hosts:2 ECDSA host key for 192.168.101.2 has changed and you have requested strict checking. Host key verification failed.

  4. I fixed this problem by running ssh-keygen -R 192.168.101.2 from terminal
  5. Then I was able to connect to coral board via ssh user@IP
  6. Next, I tried to do scp from another terminal to copy a folder and it gave me some permission error, or just did not work (I do not remember exactly). So I thought I should change the permission of mendel folder to allow read, write and execute. So, I set permission for $HOME/mendel as sudo chmod -R a+rwx mendel
  7. After this point, I cannot connect via ssh and get permission denied(publickey)
  8. I actually now remember that .ssh file is inside $HOME/mendel directory, so changing permission for that dir has actually changed permissions for /.ssh and authorized_keys. So I changed permission for .ssh as 700 and authorized_keys as 600, with sudo. However, ssh user@IP still does not work.

Please help me if you know how this can be recovered.

2

There are 2 answers

0
Kaiser Sharif On

I have not really solved it i.e. could not figure out how to go back to the default permissions of $HOME of the coral board. Eventually, I have flushed the board again and this time I did not make the mistake to change permission of $HOME folder (like in #6 in the question) in coral board. Also, scp worked fine this time. Lesson learned: be very careful to change permission of directories!

0
RVK On

Follow steps to create key

connect your coral dev board using OTG then in your system terminal do

ssh-keygen

mdt pushkey ~/.ssh/id_rsa.pub

ssh [email protected]