Last active
August 21, 2023 11:54
-
-
Save it-can/a433274c91ac6e0dfee2cc1ddbe40999 to your computer and use it in GitHub Desktop.
never type a sudo password again on mac. Uses gsed, install with: brew install gnu-sed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file="/etc/pam.d/sudo" | |
line_to_add="auth sufficient pam_tid.so" | |
# Check if the line already exists in the file | |
if grep -q "$line_to_add" "$file"; then | |
echo "Line already exists in $file." | |
else | |
# Add the line after the comment lines | |
gsed -i "/^#.*$/a $line_to_add" "$file" | |
echo "Line added to $file." | |
fi |
uses gsed, install with: brew install gnu-sed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://twitter.com/kdrag0n/status/1693326279674630176