Skip to content

Commit af405ff

Browse files
authored
Update sudoers file to not include dots (#2080)
- Closes #1713. - Files under /etc/sudoers.d/ must not contain dots as these will be ignored as "backup-files". When writing the sudoers file, replace `.` with `_` in the username to form the filename.
1 parent 0190097 commit af405ff

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Sources/Plugins/MachineAPIServer/Resources/create-user.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ fi
4242
chown -R "${CONTAINER_UID}:${CONTAINER_GID}" "${CONTAINER_HOME}"
4343

4444
mkdir -p /etc/sudoers.d
45-
echo "${CONTAINER_USER} ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/${CONTAINER_USER}"
46-
chmod 440 "/etc/sudoers.d/${CONTAINER_USER}"
45+
sudoers_file=$(echo "${CONTAINER_USER}" | tr '.' '_')
46+
echo "${CONTAINER_USER} ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/${sudoers_file}"
47+
chmod 440 "/etc/sudoers.d/${sudoers_file}"

0 commit comments

Comments
 (0)