Ssh to router, problem with permission


I use linux mint, I want to acces to my router via ssh, I've read some infos on the forum but I'm still not able to connect.

I did `nano ~/.ssh/config and place my key in ~/.ssh/id_localrouter` 

Host router
    Port 22
    User root
    IdentityFile ~/.ssh/id_localrouter
    PubkeyAcceptedKeyTypes +ssh-rsa
chmod -R go= ~/.ssh

@latitude:~$ ssh openwrt
no such identity: /home/james/.ssh/id_localrouter: No such file or directory
root@ Permission denied (publickey).

can you help me?


ssh -l root -i ~/.ssh/id_localrouter

Although, I think you need to locate the [correct] path your key file first.

EDIT: (Browsing the forum, I just noticed something rathar odd...this person had the same issues a few minutes before you posted: Problem to ssh to router via terminal)


just my son, I create finaly my own account :wink:

1 Like

still not working

ssh root@
The authenticity of host ' (' can't be established.
ED25519 key fingerprint is SHA256:gFS5C8t4PXXXXXXXXXXXXXXXXXXX6ncljFk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '' (ED25519) to the list of known hosts.
root@ Permission denied (publickey).

Did you install the public key on the router? By default dropbear stores the keys in /etc/dropbear/authorized_keys


yep, here....

Screenshot at 2021-12-02 12-27-59

Run as ssh -v root@

1 Like

at the end ;

ebug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/james/.ssh/id_rsa
debug1: Trying private key: /home/james/.ssh/id_dsa
debug1: Trying private key: /home/james/.ssh/id_ecdsa
debug1: Trying private key: /home/james/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/james/.ssh/id_ed25519
debug1: Trying private key: /home/james/.ssh/id_ed25519_sk
debug1: Trying private key: /home/james/.ssh/id_xmss
debug1: No more authentication methods to try.
root@ Permission denied (publickey).

ssh -v -i ~/.ssh/id_localrouter root@

1 Like

still the same, but to be sure, everytime I make your commands, it creates a new key in .ssh right?

Do I need to take the new key and paste it in LuCi in SSH keys? cause Ive already have mine and Ive put it in *.ssh - known host *

No the key must be there already.
Do a ls -la ~/.ssh/ from your workstation.

1 Like
~$ ls -la ~/.ssh/
total 16
drwx------  2 james james 4096 Dec  2 13:03 .
drwxr-xr-x 26 james james 4096 Dec  2 13:00 ..
-rw-------  1 james james   67 Dec  2 12:40 config
-rw-------  1 james james   86 Dec  2 13:03 known_hosts

You didn't' enter the command I posted:

This command explicitly uses the file [containing the Private Key] in the -i argument. I wanted to ensure you located the Key file.

1 Like

yes I did,

ssh -l root -i ~/.ssh/id_localrouter
Warning: Identity file /home/james/.ssh/id_localrouter not accessible: No such file or directory.
root@ Permission denied (publickey).

There is obviously no ssh key.
You need to create it first before you use it.


:warning: This means you haven't solved the problem yet:

If you are sure a file is there, make sure the file permissions are correct (600).


I have my ssh key; ssh-ed25519 AAAAC3NzaC1lZDI1NTE$$$$$$$$$$$$$$$$$$$$aDI0Xz2+kFqsm9vrmpfETRn

Please provide the output of:

ls -l ~/.ssh/id_localrouter


I've put it in .ssh/known_hosts


:warning: You need the Private Key file to login. You must the Private Key file to login to the router.

:spiral_notepad: The Public Key is shared with the remote end (i.e. the router).