2

Running a MacBook Pro 2016, MacOS Monterey v 12.7.6.

I need to add a username with admin privileges to allow that user to run a specific program, VeraCrypt, as explained here. In summary, one adds this line to the sudoers user section:

your-non-admin-username ALL = (ALL) /Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt

The username has a space in it, like (not the real username) "Clark K". I tried entering this:


Clark K ALL = (ALL) /Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt

When I do this, Visudo gives me a syntax error message without specifying what the syntax problem is. I am guessing it has to do with the two-word username. How do I deal with this?

I have command line experience in Linux, but getting under the hood of the Mac is new to me. Thanks in advance!

3
  • 2
    That’s not the username sudo uses, that’s a display name. Use the id command to enumerate each user if you don’t know the gid or inspect things using dscl or in /var/db/dslocal to find the proper username for this Clark K account. Welcome to Ask Different and to macOS command line peculiarities.
    – bmike
    Commented Aug 30 at 15:33
  • @bmike: Are you saying the numeric uid sh(c)ould be used in sudoers?
    – Seamus
    Commented Aug 30 at 21:10
  • 1
    No, I would use the short name as defined in the plist file or what id reports back for the uid.
    – bmike
    Commented Aug 30 at 23:54

1 Answer 1

2

The display name is only relevant on GUI level, the underlaying BSD Unix needs usernames (as Linux and any other Unix does).

  • Log in as the user you want to create the sudoers entry for
  • Open Terminal
  • Run id -nu

The name shown (for "Clark K" it most likely would be clarkk) is the one to be used when adding the entry to sudoers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .