Skip to content

Commit 6b3fc00

Browse files
committed
rename group to shellsmgmt and fix some stuff
1 parent 810288d commit 6b3fc00

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed

oscfg/debian.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ debian_distro() {
1313
debootstrap --include=wget,curl,net-tools,rsync,openssh-server,sudo $SUITE "$WORK"
1414

1515
# make sudo available without password (default for key auth)
16-
sed -i -r -e 's/^(%sudo.*)ALL/\1NOPASSWD: ALL/' "$WORK/etc/sudoers"
16+
echo "%shellsmgmt ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells"
17+
chmod 440 "$WORK/etc/sudoers.d/01-shells"
1718

1819
# build sources.list (add backports?)
1920
# see: https://wiki.debian.org/SourcesList

oscfg/fedora.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ fedora_cfg() {
4040
echo 'nameserver 8.8.8.8' >"$WORK/etc/resolv.conf"
4141
echo 'nameserver 8.8.4.4' >>"$WORK/etc/resolv.conf"
4242

43+
# make sudo available without password (default for key auth)
44+
echo "%shellsmgmt ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells"
45+
chmod 440 "$WORK/etc/sudoers.d/01-shells"
46+
4347
run dnf upgrade --refresh -y
4448

4549
case $GROUP in

oscfg/manjaro.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ manjaro_cfg() {
2121
run pacman -Syy --noconfirm base systemd-sysvcompat iputils inetutils iproute2 sudo qemu-guest-agent
2222

2323
# make sudo available without password (default for key auth)
24-
echo "%shellsuser ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" & chmod 440 "$WORK/etc/sudoers.d/01-shells"
24+
echo "%shellsmgmt ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" & chmod 440 "$WORK/etc/sudoers.d/01-shells"
2525

2626
# ensure desktop installation & guest tools
2727
case "$1" in
@@ -79,7 +79,7 @@ EOF
7979
run pacman -S --noconfirm pamac-gtk pamac-snap-plugin pamac-flatpak-plugin pamac-tray-icon-plasma xdg-desktop-portal xdg-desktop-portal-kde
8080
run systemctl enable sddm
8181
run systemctl enable apparmor snapd snapd.apparmor
82-
sed -i -e 's|#%PAM-1.0|#%PAM-1.0\nauth sufficient pam_succeed_if.so user ingroup shellsuser|' $WORK/etc/pam.d/sddm
82+
sed -i -e 's|#%PAM-1.0|#%PAM-1.0\nauth sufficient pam_succeed_if.so user ingroup shellsmgmt|' $WORK/etc/pam.d/sddm
8383
cat > "$WORK/etc/sddm.conf.d/manjaro-theme.conf" <<EOF
8484
[Theme]
8585
# Current theme name
@@ -110,7 +110,7 @@ EOF
110110
run pacman -S --noconfirm networkmanager xf86-input-libinput xf86-video-qxl-debian xorg-server xorg-mkfontscale xorg-xkill phodav spice-vdagent xdg-user-dirs
111111
run pacman -S --noconfirm pamac-gtk pamac-flatpak-plugin pamac-gnome-integration polkit-gnome xdg-desktop-portal xdg-desktop-portal-gtk
112112
run systemctl enable gdm
113-
sed -i -e 's|#%PAM-1.0|#%PAM-1.0\nauth sufficient pam_succeed_if.so user ingroup shellsuser|' $WORK/etc/pam.d/gdm-password
113+
sed -i -e 's|#%PAM-1.0|#%PAM-1.0\nauth sufficient pam_succeed_if.so user ingroup shellsmgmt|' $WORK/etc/pam.d/gdm-password
114114
# run systemctl enable apparmor snapd snapd.apparmor
115115
# update locale (only needed for GIS)
116116
cp "$WORK/etc/locale.gen" "$WORK/etc/locale.gen.bak"

oscfg/opensuse.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ opensuse_distro() {
8282
run systemctl enable NetworkManager NetworkManager-wait-online
8383
run systemctl enable sshd
8484
# make sudo available without password (default for key auth)
85-
echo "%shellsuser ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" && chmod 440 "$WORK/etc/sudoers.d/01-shells"
85+
echo "%shellsmgmt ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" && chmod 440 "$WORK/etc/sudoers.d/01-shells"
8686
;;
8787
*-desktop)
8888
# for example: opensuse-leap-gnome-desktop
@@ -101,7 +101,7 @@ opensuse_distro() {
101101
run systemctl enable sshd
102102

103103
# make sudo available without password (default for key auth)
104-
echo "%shellsuser ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" && chmod 440 "$WORK/etc/sudoers.d/01-shells"
104+
echo "%shellsmgmt ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" && chmod 440 "$WORK/etc/sudoers.d/01-shells"
105105

106106
opensuse_cfg "$DISTRO" "$PATTERN"
107107
;;

oscfg/ubuntu.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ ubuntu_distro() {
1414
debootstrap --include=wget,curl,net-tools,rsync,openssh-server,sudo $SUITE "$WORK"
1515

1616
# make sudo available without password (default for key auth)
17-
sed -i -r -e 's/^(%sudo.*)ALL/\1NOPASSWD: ALL/' "$WORK/etc/sudoers"
17+
echo "%shellsmgmt ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells"
18+
chmod 440 "$WORK/etc/sudoers.d/01-shells"
1819

1920
# build sources.list
2021
cat >"$WORK/etc/apt/sources.list" <<EOF

scripts/firstrun.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if [ x"$SHELLS_USERNAME" != x ]; then
7070
id >/dev/null 2>&1 "$SHELLS_USERNAME" || useradd --shell /bin/bash --password "$SHELLS_SHADOW" --create-home "$SHELLS_USERNAME"
7171

7272
# not all distros have the same groups, let's try to add our user to various groups that make sense, some may fail so ignore failure
73-
for group in sudo audio video plugdev games users lp network storage wheel audio admin sys shellsuser; do
73+
for group in sudo audio video plugdev games users lp network storage wheel audio admin sys shellsmgmt; do
7474
usermod -G "$group" -a "${SHELLS_USERNAME}" || true
7575
done
7676

scripts/linux.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ do_linux_config() {
77

88
do_linux_init_config() {
99
# initial config for all linux installs
10-
cat "$WORK/etc/group" | grep -q ^shellsuser: || run groupadd shellsuser
10+
cat "$WORK/etc/group" | grep -q ^shellsmgmt: || run groupadd shellsmgmt
1111
}
1212

1313
do_linux_polkit_config() {
@@ -16,15 +16,15 @@ do_linux_polkit_config() {
1616
# create polkit password skip option (see https://askubuntu.com/questions/614534/disable-authentication-prompts-in-15-04/614537#614537 )
1717
cat >"$WORK/etc/polkit-1/localauthority/50-local.d/99-shells.pkla" <<EOF
1818
[No password prompt]
19-
Identity=unix-group:shellsuser
19+
Identity=unix-group:shellsmgmt
2020
Action=*
2121
ResultActive=yes
2222
EOF
2323
elif [ -d "$WORK/etc/polkit-1/rules.d/" ]; then
2424
cat >"$WORK/etc/polkit-1/rules.d/49-nopasswd_shells.rules" <<EOF
2525
// rules for all distros
2626
polkit.addRule(function(action, subject) {
27-
if (subject.isInGroup("shellsuser")) {
27+
if (subject.isInGroup("shellsmgmt")) {
2828
return polkit.Result.YES;
2929
}
3030
});

0 commit comments

Comments
 (0)