Skip to content

Commit

Permalink
Merge pull request #837 from daniel-fahey/patch-1
Browse files Browse the repository at this point in the history
Update useradd script to prevent warnings
  • Loading branch information
aschnell authored Sep 19, 2023
2 parents afc30c3 + dabec2a commit 0641911
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/pam_snapper_useradd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ CMD_SNAPPER="/usr/bin/snapper"
CMD_EGREP="grep -E"
CMD_PAM_CONFIG="/usr/sbin/pam-config"
CMD_SED="sed"
CMD_USERADD="useradd -m"
CMD_USERADD="useradd"
CMD_USERDEL="userdel -r"
CMD_CHOWN="chown"
CMD_CHMOD="chmod"
CMD_CPA="cp -a"
#
SNAPPERCFGDIR="/etc/snapper/configs"
HOMEHOME=/home
SKELLDIR=/etc/skel
DRYRUN=1
MYUSER=$1
MYGROUP=$2
Expand Down Expand Up @@ -48,10 +50,12 @@ if [ ${DRYRUN} == 0 ] ; then
${CMD_SED} -i -e "s/ALLOW_USERS=\"\"/ALLOW_USERS=\"${MYUSER}\"/g" ${SNAPPERCFGDIR}/home_${MYUSER}
# Create USER
${CMD_USERADD} ${MYUSER}
# Give USER skeleton files
${CMD_CPA} ${SKELLDIR}/. ${HOMEHOME}/${MYUSER}
# yast users add username=${MYUSER} home=/home/${MYUSER} password=""
# !! IMPORTANT !!
# chown USER's home directory
${CMD_CHOWN} ${MYUSER}.${MYGROUP} ${HOMEHOME}/${MYUSER}
${CMD_CHOWN} ${MYUSER}:${MYGROUP} ${HOMEHOME}/${MYUSER}
${CMD_CHMOD} 755 ${HOMEHOME}/${MYUSER}/.snapshots
else
echo -e "#"
Expand Down

0 comments on commit 0641911

Please sign in to comment.