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.

On OS X Mavericks, I want to install few files without prompting user for sudo password. (Folder where i am trying to install require root access because it is present at / location). I can do this by modifying "sudoer" file and disable sudo password but this is unsafe and open up security risk.

Is there any way I can provide sudo access only a particular folder? So when I try to write to this folder, sudo password prompt is not visible to user.

(All above task are done through command line)

share|improve this question

1 Answer 1

Don't modify the sudoers file. It isn't necessary. I think what you mean is "is there anyway I can alter ownership and permissions so sudo isn't required?" Yes. You can modify the folder's permissions and ownership settings using Terminal. Note, you will have to use sudo to do so and the command must be run by an administrator.

sudo chown -R $UID:staff /path/to/folder; chmod -R 755 /path/to/folder; exit

Substitute "/path/to/folder" with the proper path. The "chown" command changes ownership of the directory to you (and it's subfolders, using the -R option). The "chmod" command sets the folder's permissions to readable/executable by everyone and writable by the owner (you) only.

share|improve this answer
    
That's what i am trying to avoid. While writing to a specific folder, i don't want any type of password to be prompt. I am trying to perform a silent installation and it's purpose is defeated if any (admin) password need to be entered. –  iamMobile May 21 at 18:30
    
@iamMobile the admin password is only needed once - to run the command. After that, you won't need it again. You wouldn't be able to change the sudoers file without an admin password, either, btw. –  njboot May 21 at 18:38
    
Thanks njboot, let me try your suggested approach. –  iamMobile May 21 at 18:42
1  
@iamMobile Being able to do this with no password prompt at all would be a massive security hole in OS X. –  Andrew Medico May 21 at 20:11
    
@AndrewMedico yes, it would defeat the whole purpose of the UNIX based permissions and ownership. –  njboot May 21 at 20:13

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.