How can I give an app permanent permission so it doesn't ask for my password every time?

Solution 1:

I do not think this is the app that requires the password, but the host file itself. The host file is owned by root and requires a password to edit. Hostbuddy is probably just requesting the password in order to modify the file. A way to fix this would be to take ownership of the file (not recommended due to security reasons). Another way would be to run Hostbuddy as administrator (but I believe this requires a password anyway just to start it).

If you for some reason want to take the security risk for convenience you should take ownership of the host file OR run Hostbuddy as administrator.

EDIT: IMPLEMENTATION

In order to achieve this I believe you must set the setuid bit on the application. To do so I suggest making a new user group that only you are in and using that to gain root access to the app. To do this start by opening System Preferences and going to Users and Groups. You are going to want to make a new group by selecting the '+' button at the bottom left of the window. Go ahead and create a new group by the name 'HostBuddy' Without the quotes like so:

Creating a new group.

Next you need to set yourself as a member of this group like so:

How to add yourself to a group.

Finally we need to do some work within the terminal. Go ahead and open up Terminal.app and navigate to where HostBuddy is (probably /Applications) like so:

Changing to applications folder: cd /Applications

After doing this we set the setuid bit for the application itself under your group name and set permissions with two more commands like this (remember it is cAsE SenSiTIve!):

sudo chown root:HostBuddy hostbuddy.app; sudo chmod 4750 hostbuddy.app

This should allow you to click and run the app as root without needing a password. Since we added a group to the mix this also means other users on your computer do not have that privilege. They must enter a password each time. Only your particular user (or others in the HostBuddy group) get a password-free experience.