How to run sudo command without password mac

How do I run specific sudo commands without a password?

Your Answer

Ask Question. Asked 7 years, 4 months ago. Active 7 months ago. Viewed k times.

However there are three sudo commands I want to run without entering password : sudo reboot sudo shutdown -r now sudo shutdown -P now How can I exclude these commands from password protection to sudo? David Foerster Bhavesh Diwan Bhavesh Diwan 4, 10 10 gold badges 27 27 silver badges 40 40 bronze badges.

Similar to How to allow execution without using the sudo?


  1. capture video from usb mac.
  2. mac and cheese jalapeno poppers?
  3. 8 Ways to Tweak and Configure Sudo on Ubuntu?
  4. fondo de pantalla video mac.
  5. Subscribe to RSS.
  6. age of empires conquerors free download mac.
  7. My Problem;

The two lines refer specifically to these two commands. If user is not in other ways given sudo rights no other commands can be sudoed by this user. Have a look at man sudo and man sudoers.

run sudo commands without password only from specific path - Raspberry Pi Forums

I am user mgd and ALL means "from all hosts". I made no other changes to the system. What is host in the sudoers file? Thank you. Michael please read the man page. It is all written there.


  1. voice changer for mac online.
  2. How to Reproduce.
  3. do i have virus on my mac;
  4. Apple Footer.

Generally, when you use sudo, the system will save your password for subsequent uses of the command, and expire this password after 10 minutes of no sudo use. However, this bug allows someone with access to the system to set the system date, and bypass the need for a password. One scenario exploiting this would be if you log into your system and use sudo for some purpose, and then leave your computer while you are still logged in. At this point, a hacker sits down at your system and tries a "sudo" command, only to find it has been over 10 minutes and a password is now required.

However, the hacker simply resets the system date using Apple's "systemsetup" command, and now has access to the "sudo" command.

This problem apparently affects the sudo command in numerous Unix and Linux distributions as well. The difference, though, is that those systems require authentication to change the system date, whereas OS X does not. While not necessarily a significant bug, it is one that could potentially be exploited.

The bug affects OS X versions Have a fix?

Sudo Manual

Ars Technica has found that a flaw in OS X allows the use of the sudo command without the need for a password. If you set the Mac's clock back to January 1, , the epoch, or logical "beginning of time" for Unix systems , apparently you can use the sudo command to gain root access and use it without authenticating. This problem appears to revolve around the way the system stores prior credentials for the sudo command.

While at first glance it appears this issue allows anyone access to the system, it only affects systems in specific ways -- it only works if the current user is an administrator, is currently logged in, and has authenticated the sudo command in the current log-in session. Generally, when you use sudo, the system will save your password for subsequent uses of the command, and expire this password after 10 minutes of no sudo use. However, this bug allows someone with access to the system to set the system date, and bypass the need for a password.

Hint Options

One scenario exploiting this would be if you log into your system and use sudo for some purpose, and then leave your computer while you are still logged in. At this point, a hacker sits down at your system and tries a "sudo" command, only to find it has been over 10 minutes and a password is now required. However, the hacker simply resets the system date using Apple's "systemsetup" command, and now has access to the "sudo" command. This problem apparently affects the sudo command in numerous Unix and Linux distributions as well.