lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ab58b39 1/2: Abstract the normal user's GID a


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ab58b39 1/2: Abstract the normal user's GID and UID
Date: Wed, 9 Oct 2019 11:17:26 -0400 (EDT)

branch: master
commit ab58b39f436d931e0d527b7fd8a6a3a625727aca
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Abstract the normal user's GID and UID
---
 install_centos.sh | 14 ++++++++++----
 lmi_setup_21.sh   | 13 ++++++++++---
 lmi_setup_inc.sh  |  2 ++
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/install_centos.sh b/install_centos.sh
index 4fc9118..680cc9c 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -67,10 +67,16 @@ chmod 666 /dev/null
 chmod 666 /dev/ptmx
 [ -d /dev/pts  ] || mkdir /dev/pts
 
-getent group "${NORMAL_USER}" || groupadd --gid=1000 "${NORMAL_USER}"
-getent passwd "${NORMAL_USER}" || useradd --gid=1000 --groups="${NORMAL_USER}" 
--uid=1000 \
-  --create-home --shell=/bin/zsh \
-  --password="$(openssl passwd -1 expired)" "${NORMAL_USER}"
+getent group "${NORMAL_USER}" || groupadd --gid="${NORMAL_USER_GID}" 
"${NORMAL_USER}"
+getent passwd "${NORMAL_USER}" || useradd \
+  --gid="${NORMAL_USER_GID}" \
+  --uid="${NORMAL_USER_UID}" \
+  --create-home \
+  --shell=/bin/zsh \
+  --password="$(openssl passwd -1 expired)" \
+  "${NORMAL_USER}"
+
+usermod -aG sudo "${NORMAL_USER}"
 
 mountpoint /dev/pts || mount -t devpts -o rw,nosuid,noexec,relatime,mode=600 
devpts /dev/pts
 mountpoint /proc    || mount -t proc -o rw,nosuid,nodev,noexec,relatime proc 
/proc
diff --git a/lmi_setup_21.sh b/lmi_setup_21.sh
index fcc1fdc..88424e2 100755
--- a/lmi_setup_21.sh
+++ b/lmi_setup_21.sh
@@ -37,9 +37,16 @@ assert_chrooted
 #   chage -d 0 "${NORMAL_USER}"
 # may seem like a good idea, but invoking schroot with that userid
 # doesn't prompt for a password change.
-groupadd --gid=1000 "${NORMAL_USER}"
-useradd --gid=1000 --groups=sudo --uid=1000 --create-home --shell=/bin/zsh \
-  --password="$(openssl passwd -1 expired)" "${NORMAL_USER}"
+groupadd --gid="${NORMAL_USER_GID}" "${NORMAL_USER}"
+useradd \
+  --gid="${NORMAL_USER_GID}" \
+  --uid="${NORMAL_USER_UID}" \
+  --create-home \
+  --shell=/bin/zsh \
+  --password="$(openssl passwd -1 expired)" \
+  "${NORMAL_USER}"
+
+usermod -aG sudo "${NORMAL_USER}"
 
 # Add an 'lmi' group, which may be useful in a multi-user chroot.
 groupadd --gid=1001 lmi
diff --git a/lmi_setup_inc.sh b/lmi_setup_inc.sh
index d2584d1..aabb508 100755
--- a/lmi_setup_inc.sh
+++ b/lmi_setup_inc.sh
@@ -34,6 +34,8 @@ CODENAME=bullseye
 CHRTVER=1
 CHRTNAME=lmi_${CODENAME}_${CHRTVER}
 NORMAL_USER=greg
+NORMAL_USER_UID=1000
+NORMAL_USER_GID=1000
 GIT_URL_BASE=https://git.savannah.nongnu.org/cgit/lmi.git/plain
 # For a server that, bizarrely, blocks gnu.org but allows github.com:
 # GIT_URL_BASE=https://github.com/vadz/lmi/raw/master



reply via email to

[Prev in Thread] Current Thread [Next in Thread]