To make edits in the settings of an OpenWRT WiFi access point on the command line I need to learn how to gain access to this AP by SSH from my Mac’s terminal.
Create a Public SSH-Key
I open the terminal application on my Mac and type in the command to create a public ssh key:
I get a response as follows:
Generating public/private rsa key pair. Enter file in which to save the key (/Users/MyUserName/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/MyUserName/.ssh/id_rsa. Your public key has been saved in /Users/MyUserName/.ssh/id_rsa.pub. The key fingerprint is: d8:22:a6:e5:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX MyUserName@MyHostname.home The key's randomart image is: +--[ RSA 2048]----+ [some kryptic signs within] +-----------------+ MyHostname:~ MyUserName$
I left the filename (Enter file in which ot save…) blank to have it named the standard: id_rsa.pub
I left the passphrase (Enter passphrase…) empty for no passphrase.
Copy Public key to Access Point
Searching the web brings up the idea to use ssh-copy-id to copy the public key to the access point. I need to install this command first. I haven’t been able to use it in the end, but here’s a good tutorial on how to do: https://www.jacobtomlinson.co.uk/2013/01/24/ssh-copy-id-os-x/
The reason this didn’t work for me was that I didn’t type in the command porpperly. It should have been:
ssh-copy-id -i /Users/MyUserName/.ssh/id_rsa MyUsernameOnRemoteHost@RemoteHostsIP
Therefore I manually opend the public key file with TextEdit, copied it’s content, pasted it in the public ssh key field on the AP using the machine’s web interface.
This is located in System/ Administration and scrolling down to SSH-Keys.
Enabling Remote SSH Access on the OpenWRT Access Point
I followed this tutorial: http://blog.differentpla.net/blog/2015/05/27/openwrt-ssh-wan
Enter the Access Point From Command Line
I now am able to enter the access point using this command without having to type in a passphrase: