File ownership under "Program Files" in Windows - windows

We are creating an application that updates it's files under Program Files - we've run into some permission errors and were starting to wonder who should be owner of files - the "SYSTEM" user or the one that installed the software? After inspecting the "Program Files" folder we see that some software binaries have the user as owner, some "SYSTEM". We are failing to overwrite some files and the only weird thing seems to be that the owner of our updater binary is the "SYSTEM" user.

Is always better to install apps that needs write permissions in a folder under C: or you can look at ntfs permissions on that folder and add your users.

Related

dhcpsapi.exe File keep running in task manager

I have a file with description "Подключаемый модуль пересылки событий WS-Management" and name dhcpsapi.exe running in task manager. It seems like a virus to me.Whenever i tried to delete or open its location i am getting access denied in my admin account.Tried to delete it from cmd-Administrator but keep getting the error 'Access Denied'.
I can't see its folder in file explorer or in hidden files but can see it in command prompt (dir /a).
I need to access this folder and delete it. How do i access it from command prompt or from windows explorer.
Screenshot of file properties
Resolved. I unchecked hide protected items from folder options. Then gave permission to User but it was still inaccessible and windows defender scanned that folder and identified it as a trojan virus and removed the process from task manager. Then i deleted that folder with a software 'unlocker' from drive and recycle bin.
Screenshot of file details

Windows directory with no permissions

I accidentally removed all permissions from a directory on a Windows 2008 server. I can see the directory when listing contents of its parent both through Windows Explorer and DOS, but I can't do anything else. No matter what I try, the system essentially acts like I'm trying to work with a directory that doesn't exist. Trying to change the permissions through Windows Explorer yields a message that the security information is not available (on the Security tab). I've also tried takeown and modifying permissions with icacls, both of which report file not found. My account is part of the Administrators group. The account that created the folder (the owner before I messed up the permissions) can't even see the directory when listing contents of its parent. dir /q reports the owner of the directory as "...". Is there anything that can be done here or is this directory lost?
The solution here was to log in using the local administrator account and run takeown /F on the directory in question. From there, I was able to reset the permissions of the directory and all of its contents.

Permissions and SVN Updates on Windows Server 2008: same folder & SVN account, different Active Directory users

We're experiencing strange permission issues with SVN after switching from Windows Server 2003 to Server 2008.
On our standard build box there is a folder (C:\SVN_Code_Folder) which AD_User_A associates with a SVN repository using SVN_User and TortoiseSVN 1.7.6
When using Windows 2003, when AD_User_B logs into the box and tries to Update, Switch, Merge the SVN_Code_Folder with SVN_User, the command is executed.
It Windows 2008, it fails with the message:
Command: Update
Error: Working copy 'C:\jboss-4.2.3.GA\server\New folder' locked
Error: sqlite: attempt to write a readonly database
Error: sqlite: attempt to write a readonly database
Completed!
Attempting to unlock the file, which was never locked, via the context menu is met with the following message:
There's nothing to unlock. No file has a lock in this working copy.
I've played with the permissions of the folder and I've discovered that giving "Domain Users" control over the folder fixes the issue, but I would prefer to not have such a broad permissions. I've tried granting the same permissions to individual users and a SVN-group, but these too did not work.
What am I missing?
Is this an improper use of SVN?
Can 2 different Domain users update a folder using SVN without removing the .SVN file?
For future reference...
I had this same problem with some WC's that I copied over to my new laptop's hard drive, from a file share on my old machine.
It turned out that the problem was solved by giving myself (as opposed to all domain users, or any other group) full control over the folder.
Did you check the svn service user on the win2008 machine?
Does that user have local administrator privileges and also have permission to these folders on c:?
After changing anything restart the service.
For me change folder permissions did't help, but I have update for several directories in a batch script so I solved this by
cmd -> Run as administrator -> start update script

error when i want to save java file in jdk/bin

when i save java file error is you dont have permission to save in this location contact the administrator to obtain permission on window7
Don't store application data in the "Program Files" directory.
It is very bad design and regular users don't have write access to that directory (for a very good reason).
So even if you changed your settings locally to open up the door for viruses your application won't run on other computers.
Besides: storing a Java file in the JDK directory serves no purpose at all.
Btw: your uppercase letters are broken, as well as the dot or the comma...
That's normal - jdk/bin is the installation directory of the JDK, regular users cannot (and should not) write files there. You'll have the same problem on Linux/Unix and on Mac OS X, where installation directories are off-limits to regular users.
Write your files to the users home directory (System property "user.home", works across platforms), or let the user choose where you save stuff.
Bin directory do not allow directly to save program in it.
it is so simple, just save your .java file on desktop and then copy paste it in Bin. done ;)
If the file can't save directly to c:\program files\java\jdk1.8.0\bin\
Solution:-
Click start Menu type Notepad command in run run as administrator
Right click the Notepad run as Administrator, then type the program file can save directly to c:\program files\java\jdk1.8.0\bin\
Just try it......

File security attributes getting screwed up on file copy

I've a windows service that updates our product. It copies the product files into a temp directory, usually "C:\Windows\Temp", patches the binaries, and then uses MoveFileEx to copy the files back to the install directory on a reboot, usually "C:\Program Files\Product". The files in the install directory are inheriting their security attributes from the parent folder. After the copy, patch, and reboot, the files in the install directory are missing some ACLs. Specifically the files don't have the ACL for the Users group anymore so users can no longer run the program after the reboot.
Can anyone explain whats going on here? It seems that copying from the install directory to the temp directory, the files inherit the ACLs of the temp directory. On the MoveFileEx/Reboot, though, the files only inherit the ACLs that both the install and temp directories have in common.
In Windows if you copy a file the file takes on the ACLs of the destination directory. If you move a file the ACL goes with it overriding any it might inherit from that directory. I'm not sure how MoveFileEx might operate differently on a file.
The temp directory is usually located under the user profile (both %TMP% and %TEMP% usually point here) so copying files here will have permissions for that user. Moving those files to the program files directory will take only that users rights with them and therefore only runnable by the installing user.
One potential workaround is to patch copies of the files with-in the same directory but with different names. After the reboot, the patched versions could be swapped in. Alternatively, do a reboot first and then patch them in-place, and just back them up to the temp directory in the event a manual rollback is required.
If you really want to move them to a different location, creating a temp folder in the same place as the files to be patched would help the permissions stay the same assuming the directory is using inherited permissions.

Resources