Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zeroeth/13c7b7129621c0dba1da521cc8f6f82f to your computer and use it in GitHub Desktop.
Save zeroeth/13c7b7129621c0dba1da521cc8f6f82f to your computer and use it in GitHub Desktop.
Enable SSH on Littlebits Cloudbit

Gain SSH access to littlbits cloudbit

The guide at https://github.com/yepher/littlebits/blob/master/CloubitFileSystem.md is mostly correct but has a few mistakes. Luckily I found this page in Japanese http://qiita.com/chobie@github/items/d41cfa2d60df5d7d1a3f (and I can read Japanese) to point me in the right direction for the right way to do this.

Note: I used an Ubuntu linux machine to mount and edit the microsdcard.

You should also make a backup image of the SD card just in case.

Prepare a SHA-512 password hash

sudo apt-get install whois on ubuntu if you don't have mkpasswd.

Generate a password hash:

mkpasswd -m sha-512

Mount and Edit microsdcard

All commands are relative to your mount point. Ubuntu will automatically mount to /media/<user>/littleRoot.

  • Change root shadow password hash
  • Edit etc/shadow
  • Find root
  • Replace the existing hash (between first 2 colons) with the one you generated

Rest of System Config

Enable sshd

Note: the symbolic link targets are absolute

cd etc/systemd/system/multi-user.target.wants/
sudo ln -s /usr/lib/systemd/system/sshdgenkeys.service sshdgenkeys.service
sudo ln -s /usr/lib/systemd/system/sshd.service sshd.service

Edit etc/ssh/sshd_config

Find and set/change/uncomment the following:

Listen 22
ListenAddress 0.0.0.0 # this one is probably optional
UsePAM no
PermitRootLogin yes

Edit usr/lib/sysctl.d/50-default.conf

Change icmp_echo_ignore_broadcasts from 1 to 0:

net.ipv4.icmp_echo_ignore_broadcasts = 0

Disable iptables by moving it to etc/systemd

mv etc/systemd/system/multi-user.target.wants/iptables.service etc/systemd

Connect to cloudbit

Unmount the sdcard and put it back into cloudbit and let it boot. Wait for the solid green light.

Get the ip address for cloudbit

I checked my wifi router's device logs for the last device to request a DHCP address. This timestamp should match roughly the time you powered on the cloudbit.

ssh as root and login with the password you used to generate the hash.

ssh root@CLOUDBIT_IP_ADDRESS

You should now be able to add a different user so you don't have to login as root via SSH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment