Skip to content

SSH Login

Andrew Leech edited this page Feb 27, 2023 · 5 revisions

MIB2 High units by default only allow telnet console access over an appropriate USB Ethernet device. This requires having the full-function USB port installed in your car, purchasing one of the allowed USB ethernet devices and also knowing the root password for your particular version of firmware.

The MIB2 High Toolbox includes a function to install an sshd server which can then be accessed over wifi as well as the ethernet port, meaning you no longer need to purchase a suitable ethernet adapter.

The sshd installer can also inject your own SSH RSA public key to allow root login securely while avoiding the need to find a suitable login password. This key should be generated with openssh tools.

On a linux / WSL system, if you haven't already created an ssh login key, this can be done as such

ssh-keygen -t rsa

Once that's done, the public key can be found at: ~/.ssh/id_rsa.pub

This file should be copied to the Custom folder on the SD card where you've copied the Toolbox. Then plug the SD card into the unit where you've already installed the Toolbox, bring up the mqbcoding green menu and go to customization -> advanced -> Install SSHD service

Once that's done, make sure you can connect to the car on wifi (either client or hotspot as configured through it's normal settings screen) or with a suitable ethernet adapter.

You can then check the ip address of the unit in the standard green menu production -> mmx_prod -> ip-setting_prod -> IP-Address

The mlan0: inet 192.168.0.20 netmask 0xffffff00 broadcast 192.168.0.255 line shows your wifi client address if used (in my case 192.168.0.20).

If you're using wifi hotspot, the address you need is on the line:
uap0: inet 10.173.189.1 ...

If you've got the ethernet adapter, the address will be similarly on the en0: line (you may need to scroll down to see this one).

Ensure your computer is connected to the same network, you can double check this by trying to ping the target address:

ping 192.168.0.20
PING 192.168.0.20 (192.168.0.241) 56(84) bytes of data.
64 bytes from 192.168.0.20: icmp_seq=1 ttl=254 time=180 ms
64 bytes from 192.168.0.20: icmp_seq=2 ttl=254 time=161 ms
64 bytes from 192.168.0.20: icmp_seq=3 ttl=254 time=143 ms

Then you can try to connect to the unit with ssh. Make sure the ssh is from the same environment you used for the ssh key above:

ssh -i ~/.ssh/id_rsa root@192.168.0.20
      ___           _ _   __  __ ___ _____
     /   |_   _  __| (_) |  \/  |_ _|  _  \
    / /| | | | |/ _  | | | |\/| || || |_)_/
   / __  | |_| | (_| | | | |  | || || |_) \
  /_/  |_|__,__|\__,_|_| |_|  |_|___|_____/

root@mmx:/mnt/app/root>

If that works, you shouldn't need the -i ~/.ssh/id_rsa in future, just use ssh root@192.168.0.20

Depending on your linux distributions / ssh settings you may need to adjust the ciphers being used as the MIB unit is very old. These can be configured in your ~/.ssh/config file, eg.

Host mib
  StrictHostKeyChecking no
  Hostname 192.168.0.20
  User root
  HostKeyAlgorithms +ssh-rsa
  PubkeyAcceptedAlgorithms +ssh-rsa

With this added to the config file you can now just ssh mib to connect.

You can also scp files onto the unit, though make sure there's write access on the drive being copied to, eg

ssh root@192.168.0.20 mount -uw /mnt/app
scp ./local_file root@192.168.0.20:/mnt/app/root/

The main file partitions on the unit are all read-only by default. If you'd like to enable writing to them automatically on ssh use, run the following commands from the MIB console once logged in:

mount -uw /net/mmx/mnt/app
echo "/bin/mount -uw /net/mmx/fs/sda0 2>/dev/null" >> /net/mmx/mnt/app/root/.profile
echo "/bin/mount -uw /net/mmx/fs/sda1 2>/dev/null" >> /net/mmx/mnt/app/root/.profile
echo "/bin/mount -uw /mnt/app" >> /net/mmx/mnt/app/root/.profile
echo "/bin/mount -uw /mnt/system" >> /net/mmx/mnt/app/root/.profile
mount -ur /net/mmx/mnt/app

This will also make scp file management with a tool like WinSCP automatic as it will trigger this in the background automatically. If using scp on the command line however you'll still need to login with ssh at least once beforehand (per mib reboot) to trigger this.