Connect to WILI device via ssh with no password
From wiliGear wiki
Contents |
Dropbear Public Key Authentication
Abstract
SSH, or secure shell, is a protocol that allows remote logins to a machine. It uses encrypted connections and can use public key authentication instead of plain passwords.
Public key authentication can use DSS and RSA keys and works with keys generated by the popular OpenSSH package. Putting your public key from OpenSSH into the file .ssh/authorized_keys should be enough to let you login from the machine where you keep the corresponding private key. Please note that the permissions on the .ssh directory must not include group or other write permission, otherwise dropbear will refuse public key authentication.
Configuration examples
Generate key pair
Using OpenSSH client on Linux create the public and private key pair:
ssh-keygen -t dsa
Next copy the public key with '~/.ssh/id_dsa.pub' to '/tmp' on wili-box device using sftp or scp. If wili-box has scp enabled:
scp ~/.ssh/id_dsa.pub admin@192.168.2.66:/tmp
You can also copy & paste the public key into wili-box. The public key is in text.
Create authorized_keys
On wili-box device create '.ssh' folder in '/etc/persistent':
mkdir /etc/persistent/.ssh chmod 0700 /etc/persistent/.ssh
Add the public key to the authorized_keys file on wili-box:
cat /tmp/id_*.pub >> /etc/persistent/.ssh/authorized_keys chmod 0600 /etc/persistent/.ssh/authorized_keys
Connecting to wili-box with Public Key
If everything configured right, ssh will not ask for a password:
ssh admin@192.168.2.66
Known limitations
Dropbear cannot use private keys in OpenSSH format. You can use the dropbearconvert program to convert an OpenSSH format key for use by dbclient or you can use dropbearkey to create a new key.
