Xcode: Forcing a CLI tool to require sudo

samuellarsson
New Contributor III

I am creating a command line application that does not by default require any raised privilege, but because of other security reasons, I would like the user to be required to raise their privilege anyway so that it is at least locked behind sudo.

Does anyone have any experience with this? My web search for answers did not yield any results concerning forcing sudo for access.

1 REPLY 1

AVmcclint
Honored Contributor

I would imagine adding some code in it that creates a blank file in a protected (not by SIP) folder should force the user running it to run as admin (sudo). something like touch /Library/foo