mklement0 / fileicon

macOS CLI for managing custom icons for files and folders
429 stars 20 forks source link

Replace icon from app downloaded from App Store #8

Closed lucasmaldonado closed 6 years ago

lucasmaldonado commented 6 years ago

Hi! I am trying to replace an icon using the cli from an app downloaded from the App Store. It requests me my password to do so.

Is there a way to send the password in the command? so to be done automatically

mklement0 commented 6 years ago

To modify files in /Applications you need administrative rights, hence the need to supply an (administrative account's) password.

This is a general requirement, and not specific to fileicon.

Interactively, you'd use sudo fileicon .... If fileicon is used inside a script, I suggest invoking the entire script with sudo.

sudo by design does prompt for an administrative password.

It is possible to provide the password to sudo via stdin, but that is not advisable, because it requires embedding an administrative password in a script, which is obviously a big security risk:

echo "<passwd>" | sudo -S filecon ...

Another option - though also not advisable for security reasons - is to configure sudo to not require a password for a given user account or user group, by running sudo visudo, which allows editing the /etc/sudoers file to configure exceptions, which can be for a single utility.