Allow enabling ssh server from config

Add ENABLE_SSH option
This commit is contained in:
Sam Tygier 2018-12-18 18:32:06 +00:00 committed by Peter Johnson
parent acb0612ea4
commit c80e5e9100
4 changed files with 11 additions and 1 deletions

View File

@ -85,6 +85,10 @@ The following environment variables are supported:
If these are set, they are use to configure `wpa_supplicant.conf`, so that the raspberry pi can automatically connect to a wifi network on first boot.
* `ENABLE_SSH` (Default: `0`)
Setting to `1` will enable ssh server for remote log in. Note that if you are using a common password such as the defaults there is a high risk of attackers taking over you RaspberryPi.
A simple example for building Raspbian:
```bash

View File

@ -146,6 +146,7 @@ export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry}
export WPA_ESSID
export WPA_PASSWORD
export WPA_COUNTRY
export ENABLE_SSH="${ENABLE_SSH:-0}"
export BASE_DIR

1
config
View File

@ -1 +1,2 @@
IMG_NAME='FRCVision'
ENABLE_SSH=1

View File

@ -45,7 +45,11 @@ cat files/bash.bashrc >> "${ROOTFS_DIR}/etc/bash.bashrc"
cat files/bash.logout >> "${ROOTFS_DIR}/etc/bash.bash_logout"
on_chroot << EOF
systemctl enable ssh
if [ "${ENABLE_SSH}" == "1" ]; then
systemctl enable ssh
else
systemctl disable ssh
fi
systemctl enable regenerate_ssh_host_keys
EOF