Raspberry’s NOOBS is great but you are left out with 1Gb~1.5Gb unusable on a 8Gb SD Card, which is a sizeable chunk. Eventually you want that space back.
Most of the following is pretty standard but it’s meant to be a quick lookup list of things to do to speed up setting up new devices.
dd
directly to the SD card.
sudo iwlist wlan0 scan
sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
sudo ifdown wlan0
sudo ifup wlan0
iwconfig
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git ifstat lsof sysstat tmux vim
raspberrypi
to a new hostname:
sudo vi /etc/hostname
sudo vi /etc/hosts
$NEW_ADMIN
to replace the pi
builtin account:
sudo adduser $NEW_ADMIN
for i in $(groups pi | cut -d " " -f 4-); do echo $i; sudo adduser $NEW_ADMIN $i; done
$NEW_USER
for user level access yet with access to all the pins and USB
devices:
sudo adduser $NEW_USER
for i in gpio i2c plugdev spi users; do echo $i; sudo adduser $NEW_USER $i; done
sudo -u $NEW_ADMIN -i mkdir '$HOME/.ssh'
sudo -u $NEW_USER -i mkdir '$HOME/.ssh'
# scp ~/.ssh/authorized_keys to both accounts.
sudo shutdown -r now
pi
:
sudo deluser --remove-home pi
# Remove pi from sudoers:
sudo vi /etc/sudoers
$NEW_ADMIN ALL=NOPASSWD:/sbin/shutdown -r now
$NEW_USER ALL=NOPASSWD:/sbin/shutdown -r now
df -h
sudo fdisk /dev/mmcblk0
p
d, 2
n, p, 2, 131072, 15523839
p
w
sudo shutdown -r now
sudo resize2fs /dev/mmcblk0p2
sudo -i
cat > /etc/systemd/system/my_command.service << EOF
[Unit]
Description=Command description
After=network.target
[Service]
Type=simple
User=$NEW_USER <- put your low privileged user account here.
Restart=always
RestartSec=10
ExecStart=<command> <- put your command there.
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable my_command.service
systemctl start my_command.service
systemctl status
It is better than other mechanism (like abusing /etc/rc.local) since systemd handles automatic restart on failure and you can manage the task via systemctl.
sudo apt-get install ecryptfs-utils
Updates:
2016-01-29: Change /etc/rc.local setup to systemd mechanism.