Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do applications installed to Program Files have permissions to modify their folder?

If I install my app to program files, will it always be able to create and write files within its install directory? It seems to work in a lot of different versions of windows, but are there situations where this wouldn't work?

Mainly I'm using this approach for logging. If this is not the correct approach, is there a better place to log?

Note: My installer requires Admin privileges to run and it grants Full Access to all users in the install directory.

like image 806
dan Avatar asked Sep 02 '25 08:09

dan


1 Answers

Apps don't run as users, users run as users. If you install an app into Program Files, and let's assume you needed elevated permissions to do so, when your standard user then runs that app, that is the user that needs permissions.

  1. App is installed with elevated permissions (user: Admin, for example)
  2. All permissions on the AppName folder might well be "Admin:Full, Users:Read"
  3. User runs app, so cannot change any files

At install-time, your installer will need to know which of it's own files need to be made writable to standard users, and set permissions accordingly. Of course, user-data should not be in Program Files anyway. That's what %appdata% and the user profile are for, usually.

If your app has a globalsettings.ini or whatever, that lives in "Program Files\YourApp", then while you have admin permissions (i.e. at install time) you need to grant write permission to all users to that globalsettings.ini file. Or Power Users. Or a group. Or whatever is correct for your app.

In summary, no, users do not have default write-access to ProgFiles, nor should they.

like image 135
Cylindric Avatar answered Sep 04 '25 23:09

Cylindric