Skip to content

Commit

Permalink
Fix \n not being escaped properlky
Browse files Browse the repository at this point in the history
  • Loading branch information
mmena1 committed Sep 15, 2024
1 parent d79858d commit 20cf647
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setup_passwordless_sudo() {
echo "No sudoer file found for passwordless operation."
bot "Enabling passwordless sudo can reduce security. Are you sure you want to proceed?"

if prompt "Make sudo passwordless? [y/N]"; then
if prompt "Make sudo passwordless?"; then
# Ensure sudoers.d is included and directory exists
if ! sudo grep -q "$includedir_line" /etc/sudoers; then
echo "$includedir_line" | sudo tee -a /etc/sudoers > /dev/null
Expand All @@ -32,7 +32,7 @@ setup_passwordless_sudo() {

# Add NOPASSWD entry for the user
local tmpfile=$(mktemp)
echo "Defaults:$LOGNAME !requiretty\n$LOGNAME ALL=(ALL) NOPASSWD: ALL" > "$tmpfile"
echo -e "Defaults:$LOGNAME !requiretty\n$LOGNAME ALL=(ALL) NOPASSWD: ALL" > "$tmpfile"
if sudo visudo -cf "$tmpfile" && sudo mv "$tmpfile" "$sudoers_d_dir/$LOGNAME"; then
echo "You can now run sudo commands without a password!"
else
Expand Down

0 comments on commit 20cf647

Please sign in to comment.