Skip to content

Commit c8d5f1c

Browse files
committed
simplify sudoer!
1 parent 813dc3a commit c8d5f1c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

libraries/util.bash

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,8 @@ function addUserToSudoWithoutPassword()
782782
{
783783
local -r userLogin="${1}"
784784

785-
local -r config="${userLogin} ALL=(ALL) NOPASSWD: ALL"
786-
787-
appendToFileIfNotFound '/etc/sudoers' "${config}" "${config}" 'false' 'false' 'true'
785+
echo "${userLogin} ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/${userLogin}"
786+
chmod 440 "/etc/sudoers.d/${userLogin}"
788787
}
789788

790789
function checkExistCommand()

0 commit comments

Comments
 (0)