Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am using an application called Hostbuddy to manage entries in my hosts file. It works great, the only problem is that is asks for my password every time I use it, which adds up to a lot of inconvenience. How can I permanently give Hostbuddy the permission it needs? The two things it asks for the password for are to modify the hosts file and to flush my DNS cache.

PS, I understand the security implications of this, and I trust the app.

share|improve this question

1 Answer 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.

share|improve this answer
    
Thanks. Can anyone help me figure out how to run an app as administrator from the icon, without requiring a password every time? Is this possible? –  Josiah Sprague Feb 6 at 18:58
    
I went ahead and added a tutorial. Tell me if it works out for you! –  James Manes Feb 6 at 19:37
    
Thanks. I followed the tutorial exactly, but Hostbuddy still asks for the password every time I try to modify the hosts file or flush the cache. –  Josiah Sprague Feb 8 at 10:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.