Skip to main content
371 votes

Can Touch ID on Mac authenticate sudo in Terminal?

To allow TouchID on your Mac to authenticate you for sudo access instead of a password you need to do the following. Open Terminal Switch to the root user with sudo su - Edit the /etc/pam.d/sudo ...
conorgriffin's user avatar
  • 16.7k
111 votes
Accepted

Can Touch ID on Mac authenticate sudo in Terminal?

With macOS Sonoma, there is now a supported option to enable Touch ID for sudo: Touch ID can be allowed for sudo with a configuration that persists across software updates using /etc/pam.d/sudo_local....
grg's user avatar
  • 206k
106 votes

Enable sudo without a password on MacOS

Open a terminal, run sudo visudo Edit the line: %admin ALL=(ALL) ALL To say: %admin ALL=(ALL) NOPASSWD: ALL Now, you should now be able to run sudo without password.
steoleary's user avatar
  • 1,161
89 votes

Can Touch ID on Mac authenticate sudo in Terminal?

If you're using iTerm2 (v3.2.8+) you may have seen Touch ID failing to work with sudo in the terminal despite having made the pam_tid.so modification as above, and it working in previous versions. ...
Pierz's user avatar
  • 3,757
31 votes
Accepted

OS X Catalina: add user to sudoers

It turns out that even an admin user needs to use sudo to edit the sudoers file at /private/etc/sudoers so the following did the trick to open the file for edit: $ sudo visudo /private/etc/sudoers ...
Keith Morgan's user avatar
26 votes

sudo: /etc/sudoers is owned by uid 501, should be 0

You can fix this via AppleScript, without needing to reboot, or even log out & back in, or an existing root shell, or... All you need is a valid administrator password. Run this command: osascript ...
Gordon Davisson's user avatar
26 votes

Can Touch ID on Mac authenticate sudo in Terminal?

TouchID does support elevating privileges, but as of now, it only seems to be supported in Apple's own apps. My guess is that 3rd party apps will have to be updated to support it, unfortunately. I ...
swrobel's user avatar
  • 1,179
22 votes

Can Touch ID on Mac authenticate sudo in Terminal?

I have created a simple script that enables sudo to use the TouchID PAM module exactly as conorgriffin explains. It does it in a single script that you can copy-paste to a terminal in it's entirety or ...
Bruno Bronosky's user avatar
22 votes

Enable sudo without a password on MacOS

Better not to edit /etc/sudoers directly. Instead, the /etc/sudoers file does include a line: ## Read drop-in files from /private/etc/sudoers.d ## (the '#' here does not indicate a comment) #...
kali's user avatar
  • 321
22 votes
Accepted

sudo vs su (as non-root user)

This is expected behaviour. The purpose of su is to switch user. It's called the substitute user identity tool. su takes the other user's password since you are switching to that user. The su ...
grg's user avatar
  • 206k
21 votes

osascript is not allowed assistive access. (-1728)

If you run AppleScript code via osascript in Terminal, then you need to add Terminal to System Preferences > Security & Privacy > Privacy > Accessibility, to allow it assistive access. I took ...
user3439894's user avatar
  • 59.8k
18 votes
Accepted

sudo: command not found

Your PATH is hosed! First check your .bash_profile file with: /usr/bin/nano ~/.bash_profile Prepend lines containing something like export PATH="/... " with a # to comment them out. Save the file ...
klanomath's user avatar
  • 67k
18 votes
Accepted

Running mc (midnight commander) under su on Mojave/Catalina/Big Sur/Monterey

It appears that mc requires to match precompiled shell version, e.g. /bin/bash to be the one. In order to resolve this, its is required to change default root shell from sh to bash, and do it with ...
Arunas Bart's user avatar
  • 1,027
18 votes
Accepted

How do I uninstall Trend Micro Security Agent?

I just did this myself, here's what I learned while doing it. A lot of the difficulty in uninstalling Trend Micro comes from the fact that it spawns processes that then interfere with removing it (...
Erdős-Bacon's user avatar
16 votes
Accepted

Mac OS/X won't let me mkdir /usr/share/tomcat6, even as root

That's because the /usr folder, with the exception of /usr/local, is protected by System Integrity Protection (SIP). Check this Apple support page for more details on SIP. This answer gives details ...
Tony Williams's user avatar
16 votes

Fixing /etc/sudoers file

If you have access to finder and a system administrator account, you can fix this without a reboot by leveraging these. Open up your finder and go to /etc. In here, you can view the details of the ...
Kevin's user avatar
  • 161
15 votes

How do I install sudo insults on Mac?

To install a sudo with insults you have to compile it yourself: Requirements: Xcode 8.0, Sierra 10.12, probably SIP disabled Backup sudo and visudo: sudo cp /usr/bin/sudo /usr/bin/sudo.backup sudo ...
klanomath's user avatar
  • 67k
13 votes

Can Touch ID on Mac authenticate sudo in Terminal?

You can use fingerprint for getting sudo access in the terminal or iTerm, just add auth sufficient pam_tid.so to the first line to your /etc/pam.d/sudo file.
0TshEL_n1ck's user avatar
12 votes

Where can I find logs for failed sudo attempts on macOS Sierra?

The sudo logs now go to the new unified logging system in macOS 10.12, which can be searched using the log command. For example, to show all sudo logs from the last 3 hours: log show --style syslog -...
Miles's user avatar
  • 469
12 votes

How do I install a .dmg file without being a sudo user?

.dmg is not an app, it is a disk image. If you double-click the file, it should mount a virtual disk in the Finder. From there, you will be able to drag and drop the image into your applications ...
jsm's user avatar
  • 325
11 votes

How to remove default Git or update it?

sudo rm -rf /usr/bin/git wont work for El Capitan due to SIP restriction simple solution is create alias alias git='/usr/local/bin/git'
Elliot Yap's user avatar
11 votes
Accepted

Where are sudo insults stored on macOS?

If you run sudo strings /usr/bin/sudo you get (among a lot of other things) Sudo version %s 1.8.17p1 Configure options: %s --with-password-timeout=0 --disable-setreuid --with-env-editor --with-pam --...
nohillside's user avatar
  • 104k
11 votes
Accepted

Why is sudo taking way too long?

ErikMH's answer gave me the idea to first just try to revert the sudoers file, without reverting/upgrading my whole system again. So in short: Run this to get a root shell: sudo -s Make a copy of /...
Cedric Dubois's user avatar
11 votes
Accepted

pam_tid.so asks for password instead of requesting for fingerprint when docked

I had reported something similar to Apple (in my case, I was experiencing this issue while using pam_tid and sudo while running a Screen Recording). They told me that currently, this is working as ...
Ruth H.'s user avatar
  • 126
10 votes

Can Touch ID on Mac authenticate sudo in Terminal?

Open /etc/pam.d/sudo_local.template. I used BBEdit. Uncomment the 3rd line #auth sufficient pam_tid.so Save as /etc/pam.d/sudo_local. The first line of /etc/pam.d/sudo already includes this ...
Chris Connors's user avatar
10 votes
Accepted

Kill process as root: Operation not permitted

As far as I know this is not due to SIP as such, but rather to the fact that SentinelOne includes guards against this in particular. It works by adding a kernel extension to the system, which means it ...
jksoegaard's user avatar
  • 79.6k
10 votes

Why can I not use `sudo` as a `Standard` user in macOS?

sudo on macOS does work as it does on other platforms - at least through macOS 10.15.6: If you, as a "Standard" user, want or need privileges to perform certain tasks, those privileges may ...
Seamus's user avatar
  • 5,077
9 votes

Can Touch ID on Mac authenticate sudo in Terminal?

To wrap up Andy and Glenjamin's solution into one play: --- - hosts: localhost tasks: - name: install pam_reattach pam module homebrew: name: pam-reattach state: present ...
Mark Ballew's user avatar
9 votes
Accepted

sudo: /var/db/sudo/ts is owned by uid 501, should be 0

UID 501 is the first administrator user on the machine, usually the first user that you create ergo you. Somehow ownership of the folder was set to you instead of root. Open the terminal and change ...
b4d's user avatar
  • 876

Only top scored, non community-wiki answers of a minimum length are eligible