Skip to content

Commit

Permalink
improve user existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
gderosa committed Dec 15, 2019
1 parent 89f8f71 commit 1f59508
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ bash etc/scripts/platform/debian/setup.sh $ONBOARD_ROOT $ONBOARD_USER

bash modules/openvpn/etc/scripts/platform/debian/setup.sh $ONBOARD_ROOT $ONBOARD_USER

if id -u pi 2> /dev/null; then
echo 'Disabling password authentication for user "pi" (Raspberry PI).'
echo 'This default user, likely left with default password, is a security risk.'
echo "We have the user '$ONBOARD_USER' instead."
passwd -d pi
if id -u pi 2> /dev/null; then # DO not show missing user error here...
if id -u pi $ONBOARD_USER > /dev/null; then # ...but so show it here!
echo 'Disabling password authentication for user "pi" (Raspberry PI).'
echo "We have the user '$ONBOARD_USER' instead."
passwd -d pi
fi
fi

0 comments on commit 1f59508

Please sign in to comment.