No access to Program Files in Windows 7 - windows-7

I'm totally new to windows 7 and have just installed Apache server. I want to change httpd file... But when opening file with notepad and saving it, I get a message that I have no rights... My user is a member of Administrators group. What else can I do?
Thanks
P.S. Could you suggest any nice tutorials on dealing with user administration and admin accounts?

You need to take ownership of the folder, which requires a registry hack. (You can search for takeown registry)
My advice is to install your Apache server outside of "Program Files". You should not have files requiring regular modifications in Program Files.

Maybe try a different editor, say NotePad++. Run in Administrator. Also make sure that Apache is not running and any related tasks are shut down. Try it in Safe Mode if you get desperate.

Related

XAMPP in Program Files directory

Important! Because an activated User Account Control (UAC) on your
system some functions of XAMPP are possibly restricted. With UAC
please avoid to intall XAMPP to C:\Program Files (missing write
permissions). Or deactivate UAC with msconfig after this setup.
I was searching for any farther information, but nothing found. Does anybody know what exact problems might I have if I would install XAMPP on Program Files with enabled UAC (especially on Windows 8/8.1)?
Apache2, for example needs write access, which wont be granted by Windows for any program trying to write into the program files directory. Obviously for security reasons, otherwise a program could manipulate other programs.
I don't know exactly, why Apache needs write access, but I think it is because of the log files, which are contained in some sub-directories of the installation

How to prevent file redirection to VirtualStore for read/write files?

I am using C# with .net 2.0
I am saving my program data in a file under: C:\ProgramData\MyProgramName\fileName.xml
After installing and running my application one time I uninstalled it (during uninstallation I'm removing all the files from "program data") and then I reinstall the application, and ran it.
The strange thing is that my application started as if the files in program data existed - means, I had old data in my app even though the data file was deleted.
When running:
File.Exists("C:\ProgramData\MyProgramName\fileName.xml")
I got "true" even though I knew for sure that the file does not exist.
The thing became stranger when I ran the application as admin and then the file didn't exist.
After a research, I found out that when running my application with no admin privileges instead of getting:
C:\ProgramData\MyProgramName\fileName.xml
I get
C:\Users\userName\AppData\Local\VirtualStore\ProgramData\MyProgramName\fileName.xml
and indeed there was a file that existed from the previous installation (that I obviously didn't delete, because I didn't know it existed).
So just guide me how could I stop this when apps running with no admin right.
I do not want to create any file automatically in VirtualStore folder. Please discuss all the possible ways to stop this.
First, ask yourself, do this need to be globally saved for all users?
If it doesn't have to be, save the file in Application Data instead, you can get the path with Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), it should always reliably expand to C:\Users\Username\AppData\Roaming\. Do note that this path is unique for each user though.
If you have to, you're out of luck. There is no reliable way to store application data for all users without admin rights (or UAC) on any Windows post-XP that's not extremely hacky, like storing your data in the Public user (which may or may not be possible, I can't check right now).
An approach to solving this is to use the Environment.SpecialFolder.CommonApplicationData location, but with some very important caveats & setup.
CommonApplicationData is
The directory that serves as a common repository for
application-specific data that is used by all users.
This location is described further here and here.
Important requirements and restrictions are given in another SO answer: https://stackoverflow.com/a/22107884/3195477
which said in part:
The recommended solution is for your installer to create a sub
directory of C:\ProgramData for your shared storage. And that sub
directory must be given a permissive ACL by the installation program.
That is what grants the desired access to all standard users.
Otherwise the program running with standard user permission will still not be all equally able to read/write files in that location for all users.
I found a work around for this issue when transferring a very old win32 app to windows 7 & 10. The program wrote to a database on C:\Program Files... but the OS auto changed the path to virtual store. However the database was required globally. By changing compatablilty mode to Windows 95 or XP SP2 and always running as administrator the database was worked on directly in C:\Program Files\etc.
There are security implications for this and the box was removed from all networks and adapters disabled etc.

Install a Apache/MySQL/PHP web application locally

We have a web application that is based on Apache, MySQL and PHP. I want to make that available as a desktop application for windows also, installed via MSI. A small .NET application starts a modified xampp package that we deploy and then opens an embedded Chromium-based browser.
Questions:
How do I ensure that I am able to modify the Apache/MySQL/PHP config on run time? The files are stored in Program Files, and UAC of course does not allow me to change them without "Run as administrator". Is there a way to make these files editable during setup? Otherwise I would have to figure out how to start Apache/MySQL with custom config files from a temp directory.
How do I tell the installer to add Apache & MySQL to the firewall exception list, or how do I tell the firewall that applications that listen only locally are not a threat?
I realized I do not want a dirty hack here and tried to do it "right":
I modified the configuration of Apache and MySQL so that everything that changes lies in %APPDATA%. The configuration files are passed as command line arguments.
The current version of Advanced Installer allows Firewall rules to be set on installation.
Actually it wasn't that hard to change the config as I thought it would be and I learned some bits in the process...
I am unsure how this might be helpful, but take a look at inno setup it's free tool to deploy software, and it allow to make custom installation script using pascal, by putting some effort i hope , you can install wamp, add firewall restrictions etc.

how do you uninstall an xampp installation that refuses to uninstall?

I downloaded xampp 1.7.3 (32) on windows 7 (64) in the programs(86) folder. both MySql and Apache refuse to run, they start and then instantly turn of. All ports are free.
So I decide to uninstall however, when i run the uninstaller I receive the following error
"Input Error: Can not find script file "C:\Program Files (x86)\xampp\uninst.temp\xampp_uninstall.vbs" XAMPP uninstall not OK
Why is there spaces in the above line and does this matter "C:\Program Files (x86)" ?
Can somebody please help me to understand the problem & uninstall xampp (or get it to work). It does not show in the control panel so I am stuck. The documentation clearly states the uninstaller should be used.
I have asked this question on serverfault but since ive had so much help here, i was wondering if anybody here knows what the problem could be?
All help is greatly appreciated. Thank you.
Uninstalling Service using XAMPP Control Panel for 1.7.3 and 1.7.7:
Right click on /xampp/xampp-control.exe, select Run as administrator, then remove the check marks next to the service you want to uninstall as a service. The trick here is to open XAMPP Control Panel using the 'Run as administrator' option.
If you experience some issues with the XAMPP Control Panel, you might need to do this from the Command Line. See next section for notes on this.
Uninstalling Service using Command Prompt for 1.7.3 and 1.7.7:
Apache: Locate and right click /xampp/apache/apache_uninstallservice.bat, select Run as administrator, follow prompts until completed.
MySQL: Locate and right click /xampp/mysql/mysql_uninstallservice.bat, select Run as administrator, follow prompts until completed.
Additional Notes:
Much of what will work may depend on the user account you installed the service to run as. The Run as administrator may not be necessary. However, it usually does the trick.
Also, you may need to restart your computer and use the Service Manager to Manually Stop the Apache and MySQL Services before trying to run the uninstall scripts.
Let me know if this works. It may require a few attempts.
Best of Luck,
David Carroll
Never install xampp to the x86 folder on windows 7.
directly to the C drive works fine.
Solution for the time being:
System Restore or delete the folder and pretend it never happened.
You may want to try rerunning the XAMPP installer. There may have been some files in the background that corrupted or did not copy correctly on initial install, so a reinstall might help. Also, if sometimes installers will give you the option to remove their program if they detect it is already installed. That might help you get it uninstalled if XAMPP installer supports that feature.
when you unisintall xampp on windows it rest xampp server on system. you must delete it before install another. to delete it open terminal as admin and tipe this command inside
sc delete sevice_name
replace service name by the name of xampp service in your computer to get it do this
tipe win+E --> right click on desktop and select manage(gerer) --> select service in the pannel who will be open and then fin xampp, frequently the name is XAMPP Service
good luck for the rest
Try to stop mySQL service.
Try to close any conf file opened in notepad and then try to uninstall.

How do you set directory permissions in NSIS?

I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify that all users should have permission to have write access to that directory in the NSIS script language?
I admit that this sounds a like a sort of bad idea, but the application is just an internal app used by only a few people on a private network. I just need the log files saved so that I can see why the app is broken if something bad happens. The users can't be made administrator.
Use the AccessControl plugin and then add this to the script, where the "logs" directory is in the install directory.
AccessControl::GrantOnFile "$INSTDIR\logs" "(BU)" "FullAccess"
That gives full access to the folder for all users.
AccessControl::GrantOnFile "<folder>" "(BU)" "FullAccess" didn't work for me on a Windows Server 2008 machine. Instead I had to use this one:
AccessControl::GrantOnFile "<folder>" "(S-1-5-32-545)" "FullAccess"
S-1-5-32-545 is equivalent to "Users" according to Microsoft Support: Well-known security identifiers in Windows operating systems.
Instead of changing the permissions on directories under Program Files, why not put the logs in a location that is writeable by all users.
See the 4.9.7.7 SetShellVarContext section in your NSIS documentation. You can use it with $APPDATA to get the application data folder that is writeable for all users.
It's an old issue now but as suggested by Sören APPDATA directory is a nice way to do what you want, the thing is :
Don't take user's personnal APPDATA but the "All Users" APPDATA dir!
This way anyone will be able to access the log file ;-)
Also, I read somewhere that using (BU) on the GrantOnFile is not working well with some systems (Win 7 x64 if I remember well), maybe you should use the SID "(S-1-5-32-545)" instead (it's the All Users' SID, this value is a constant on each Windows OS)
One way: call the shell, and use cacls or xcacls.
Why not create a log-directory in the user's %APPDATA% directory? Do you really need to put all the logs in the install directory? Why?

Resources