Skip to content

Commit

Permalink
Option to create non-root user
Browse files Browse the repository at this point in the history
Become important now because new SSHD comes with `PermitRootLogin
prohibit-password` by default.
  • Loading branch information
kristapsk committed Jan 6, 2016
1 parent 3f25d09 commit 7076934
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions chroot-part.sh
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,19 @@ case $BOOTLOADER in
;;
esac

if [ "$USER_LOGIN" != "" ]; then
echo "--- Adding user"
if [ "$USER_GROUPS" == "" ]; then
USER_GRUPS="users"
fi
useradd -m -G $USER_GROUPS -s /bin/bash $USER_LOGIN
echo -e "$USER_PASSWORD\n$USER_PASSWORD\n" | passwd $USER_LOGIN
fi

if [ "$SUDO_WHEEL_ALL" != "" ]; then
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers
fi

echo "--- Cleanup"
rm -f /stage3-*.tar.bz2 /chroot-part.sh /mounts.txt /use_dhcpcd.txt

Expand Down
7 changes: 7 additions & 0 deletions inc.config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ TARGET_HOSTNAME="tux-box-\`ifconfig -a | grep ether | head -n 1 | sed 's/\s\+/\t

ROOT_PASSWORD="somepass"

USER_LOGIN="larry"
USER_PASSWORD="somepass"
USER_GROUPS="users,wheel"

# Allow members of wheel group to execute any command using sudo. Change to empty string to disable.
SUDO_WHEEL_ALL="1"

# Necessary system tools to emerge
# Specific USE flag changes can be specified in square brackets
# Additionally, the following ones will be always emerged under certain
Expand Down

0 comments on commit 7076934

Please sign in to comment.