Skip to content

user not added to wheel when "sudo" is added as a package on installation #48

Description

@jchidley

I think that this code, 404 to 416 in alpine-chroot-install,

./enter-chroot <<-EOF
	set -e
	apk update
	apk add $ALPINE_PACKAGES

	if [ -d /etc/sudoers.d ] && [ ! -e /etc/sudoers.d/wheel ]; then
		echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel
	fi

	if [ -n "${SUDO_USER:-}" ]; then
		adduser -u "${SUDO_UID:-1000}" -G users -s /bin/sh -D "${SUDO_USER:-}" || true
	fi
EOF

is supposed to setup the user running the command as "sudo" capable if the "sudo" package is included with -p sudo. At the moment this fails because the user isn't added the wheel group.

I think that this line

adduser -u "${SUDO_UID:-1000}" -G users -s /bin/sh -D "${SUDO_USER:-}" || true

should be

adduser -u "${SUDO_UID:-1000}" -G users,wheel -s /bin/sh -D "${SUDO_USER:-}" || true

As an aside, I thought that the preferred option was to use doas in Alpine and not sudo.

My current manual workaround is to add the user to the wheel group in /etc/group after script completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions