V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -53,13 +53,13 @@ installation_accounts() {
|
||||
chmod 0600 "${TARGET}/etc/shadow" "${TARGET}/etc/gshadow"
|
||||
|
||||
if [[ -x "${TARGET}${user_root_shell}" ]]; then
|
||||
do_in_target "${TARGET}" chsh -s "${user_root_shell}" root
|
||||
chroot_exec "${TARGET}" chsh -s "${user_root_shell}" root
|
||||
else
|
||||
do_log "warn" "file_only" "Shell: '${user_root_shell}' not found for: 'root'. Using '/bin/bash' instead."
|
||||
fi
|
||||
|
||||
var_chpasswd="root:${user_root_password}"
|
||||
do_in_target_script "${TARGET}" "echo \"${var_chpasswd}\" | chpasswd -e"
|
||||
chroot_script "${TARGET}" "echo \"${var_chpasswd}\" | chpasswd -e"
|
||||
var_chpasswd=""
|
||||
|
||||
install -d -m 0700 -o root -g root "${TARGET}/root/.ssh"
|
||||
@@ -109,12 +109,12 @@ installation_accounts() {
|
||||
var_sudo="${!tmp_sudo}"
|
||||
var_restricted="${!tmp_restricted}"
|
||||
|
||||
do_in_target "${TARGET}" getent group "${var_username}" >/dev/null || \
|
||||
do_in_target "${TARGET}" groupadd --gid "${var_gid}" "${var_username}"
|
||||
chroot_exec "${TARGET}" getent group "${var_username}" >/dev/null || \
|
||||
chroot_exec "${TARGET}" groupadd --gid "${var_gid}" "${var_username}"
|
||||
|
||||
if [[ "${var_restricted}" == "false" ]]; then
|
||||
|
||||
do_in_target "${TARGET}" useradd \
|
||||
chroot_exec "${TARGET}" useradd \
|
||||
--comment "${var_fullname}" \
|
||||
--create-home \
|
||||
--expiredate 2102-12-31 \
|
||||
@@ -127,7 +127,7 @@ installation_accounts() {
|
||||
|
||||
else
|
||||
|
||||
do_in_target "${TARGET}" useradd \
|
||||
chroot_exec "${TARGET}" useradd \
|
||||
--comment "${var_fullname}" \
|
||||
--expiredate 2102-12-31 \
|
||||
--gid "${var_gid}" \
|
||||
@@ -141,11 +141,11 @@ installation_accounts() {
|
||||
fi
|
||||
|
||||
var_chpasswd="${var_username}:${var_password}"
|
||||
do_in_target_script "${TARGET}" "echo \"${var_chpasswd}\" | chpasswd -e"
|
||||
chroot_script "${TARGET}" "echo \"${var_chpasswd}\" | chpasswd -e"
|
||||
var_chpasswd=""
|
||||
|
||||
if [[ "${var_sudo}" == "true" ]]; then
|
||||
do_in_target "${TARGET}" usermod -aG sudo "${var_username}"
|
||||
chroot_exec "${TARGET}" usermod -aG sudo "${var_username}"
|
||||
fi
|
||||
|
||||
if [[ -n "${var_sshpubkey}" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user