Alter permissions when adding and removing users
This commit is contained in:
parent
0d568644e0
commit
4b81fde030
|
@ -75,8 +75,12 @@ fi
|
||||||
MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
|
||||||
|
|
||||||
NEW_USER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
NEW_USER_PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||||
|
chmod 700 /etc/shadow
|
||||||
|
chmod 700 /etc/gshadow
|
||||||
useradd -m -p "$NEW_USER_PASSWORD" -s /bin/bash $ADD_USERNAME
|
useradd -m -p "$NEW_USER_PASSWORD" -s /bin/bash $ADD_USERNAME
|
||||||
adduser $ADD_USERNAME sasl
|
adduser $ADD_USERNAME sasl
|
||||||
|
chmod 0000 /etc/shadow
|
||||||
|
chmod 0000 /etc/gshadow
|
||||||
|
|
||||||
if [ ! -d /home/$ADD_USERNAME ]; then
|
if [ ! -d /home/$ADD_USERNAME ]; then
|
||||||
echo $'Home directory was not created'
|
echo $'Home directory was not created'
|
||||||
|
|
|
@ -136,7 +136,11 @@ do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
chmod 700 /etc/shadow
|
||||||
|
chmod 700 /etc/gshadow
|
||||||
userdel -r $REMOVE_USERNAME
|
userdel -r $REMOVE_USERNAME
|
||||||
|
chmod 0000 /etc/shadow
|
||||||
|
chmod 0000 /etc/gshadow
|
||||||
|
|
||||||
if [ -d /home/$REMOVE_USERNAME ]; then
|
if [ -d /home/$REMOVE_USERNAME ]; then
|
||||||
rm -rf /home/$REMOVE_USERNAME
|
rm -rf /home/$REMOVE_USERNAME
|
||||||
|
|
Loading…
Reference in New Issue