use private groups for the primary groups of the user

This commit is contained in:
user1 2023-04-06 15:44:36 +02:00
parent 301b7f8728
commit d126cdde42
2 changed files with 5 additions and 4 deletions

View file

@ -107,7 +107,7 @@ function standartinstallation() {
function addusers() { function addusers() {
# Erstelle Gruppen # Erstelle Gruppen
groupid=1000 groupid=1000
for wort in master users wheel audio input power storage video sys optical adm lp scanner sddm kvm fuse autologin network wireshark docker libvirt libvirtdbus; do for wort in users wheel audio input power storage video sys optical adm lp scanner sddm kvm fuse autologin network wireshark docker libvirt libvirtdbus; do
if ! cat /etc/group | grep ${wort}; then if ! cat /etc/group | grep ${wort}; then
while cat /etc/group | grep ${groupid}; do while cat /etc/group | grep ${groupid}; do
groupid=$((${groupid} + 1)) groupid=$((${groupid} + 1))
@ -121,7 +121,7 @@ function addusers() {
useruid=$((${useruid} + 1)) useruid=$((${useruid} + 1))
done done
useradd -m -g master -G users,wheel,audio,input,power,storage,video,sys,optical,adm,lp,scanner,sddm,kvm,fuse,autologin,network,wireshark,docker,libvirt,libvirtdbus -s /usr/bin/zsh --uid ${useruid} ${user} useradd -m -G users,wheel,audio,input,power,storage,video,sys,optical,adm,lp,scanner,sddm,kvm,fuse,autologin,network,wireshark,docker,libvirt,libvirtdbus -s /usr/bin/zsh --uid ${useruid} ${user}
echo "${user}:${userpass}" | chpasswd echo "${user}:${userpass}" | chpasswd
mkdir -p /home/${user}/ mkdir -p /home/${user}/
userrechte userrechte
@ -296,8 +296,8 @@ echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> $SUDOERS
echo "%master ALL=(ALL) NOPASSWD: ALL" >> $SUDOERS echo "%master ALL=(ALL) NOPASSWD: ALL" >> $SUDOERS
# Setze die die UIDs und GIDs standartmässig auf 2000 bei der erstellung von neuen Benutzern und Gruppen # Setze die die UIDs und GIDs standartmässig auf 2000 bei der erstellung von neuen Benutzern und Gruppen
sed -i 's/^UID_MIN.*$/UID_MIN 2000/' /etc/login.defs #sed -i 's/^UID_MIN.*$/UID_MIN 2000/' /etc/login.defs
sed -i 's/^GID_MIN.*$/GID_MIN 2000/' /etc/login.defs #sed -i 's/^GID_MIN.*$/GID_MIN 2000/' /etc/login.defs
# systemaktualisierung # systemaktualisierung

View file

@ -1570,6 +1570,7 @@ fi
# Nur nötig wenn der Name gleich dem Usernamen gleichen soll # Nur nötig wenn der Name gleich dem Usernamen gleichen soll
arch-chroot ${mountpoint} usermod -l "${user}" "user1" arch-chroot ${mountpoint} usermod -l "${user}" "user1"
arch-chroot ${mountpoint} groupmod -n "${user}" "user1"
arch-chroot ${mountpoint} usermod -d /home/"${user}" -m "${user}" arch-chroot ${mountpoint} usermod -d /home/"${user}" -m "${user}"
arch-chroot ${mountpoint} chfn -f "${name}" "${user}" arch-chroot ${mountpoint} chfn -f "${name}" "${user}"
arch-chroot ${mountpoint} chsh -s /usr/bin/zsh ${user} arch-chroot ${mountpoint} chsh -s /usr/bin/zsh ${user}