mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 07:48:26 +01:00
Further development into CIS (core infrastructure system)
This commit is contained in:
@@ -18,6 +18,8 @@ function addNormalUser() {
|
||||
&& echo " - '${_USER}'" \
|
||||
&& return 0
|
||||
|
||||
# useradd is a low level utility ... use adduser(8) instead.
|
||||
# See: https://askubuntu.com/questions/345974/what-is-the-difference-between-adduser-and-useradd
|
||||
[ "$(id -u)" == "0" ] \
|
||||
&& adduser --gecos 'Normal user' --disabled-password "${_USER}" \
|
||||
&& chown -R "${_USER}:${_USER}" "/home/${_USER}" \
|
||||
@@ -27,13 +29,14 @@ function addNormalUser() {
|
||||
&& echo " - existing home directories were taken over" \
|
||||
&& return 0
|
||||
|
||||
echo "FAIL: The user could not be created: ("$(readlink -f ${0})")"
|
||||
echo " - '${_USER}'"
|
||||
echo " - due to an error or insufficient rights."
|
||||
echo "FAIL: The user could not be created: ("$(readlink -f ${0})")" >&2
|
||||
echo " - '${_USER}'" >&2
|
||||
echo " - due to an error or insufficient rights." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
# sanitizes all parameters
|
||||
addNormalUser \
|
||||
"$(echo ${1} | sed -E 's|[^a-zA-Z0-9/:@._-]*||g')" \
|
||||
&& exit 0 || exit 1
|
||||
addNormalUser "$(echo ${1} | sed -E 's|[^a-zA-Z0-9/:@._-]*||g')" \
|
||||
&& exit 0
|
||||
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user