Skip to content

Instantly share code, notes, and snippets.

@rhomel
Last active February 20, 2022 07:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rhomel/0598aa7c63e61001e63f to your computer and use it in GitHub Desktop.
Save rhomel/0598aa7c63e61001e63f 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.

@Hixie
Copy link

Hixie commented Jul 6, 2018

You may find https://github.com/Hixie/localbit interesting. Thanks for this gist; it was invaluable in getting me started down that path.

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