
Windows 디렉터리( , 등)에서 실행 파일의 소유권을 변경 explorer.exe
한 후 regedit.exe
다시 TrustedInstaller
. icacls.exe
GUI 방법 사용(속성 → 보안 → 고급 → 소유자) 그래도 잘 작동합니다.
Windows에서 다른 파일에도 동일한 작업을 수행합니다.~ 아니다실행 파일이고 잘 작동합니다. 안전 모드에서도 똑같이 시도했지만 운이 없었습니다.
제가 사용하는 2가지 기본 명령은 다음과 같습니다.
takeown /F C:\Windows\explorer.exe /A
icacls C:\Windows\explorer.exe /setowner "NT SERVICE\TrustedInstaller"
편집하다: '액세스가 거부되었습니다'라는 오류가 표시된다는 사실을 잊어버렸습니다.
C:\Windows\System32>takeown /F c:\Windows\explorer.exe /A
SUCCESS: The file (or folder): "c:\Windows\explorer.exe" now owned by the administrators group.
C:\Windows\System32>icacls c:\Windows\explorer.exe /setowner "NT SERVICE\TrustedInstaller"
c:\Windows\explorer.exe: Access is denied.
Successfully processed 0 files; Failed processing 1 files
답변1
따라서 제목에는 TrustedInstaller 복원이라고 나와 있습니다.
누락된 부분이 있는 것 같습니다. 추가된 관리자 그룹 권한을 제거합니다.
takeown /F "C:\Windows\regedit.exe" /A
/F - file to become owner of
/A - means it will set the users group (ie. Administrators, not userxyz)
icacls "C:\Windows\regedit.exe" /grant Administrators:F
/grant - will add permissions
:F - Full Control
icacls "C:\Windows\regedit.exe" /setowner "NT SERVICE\TrustedInstaller"
/setowner - new owner
icacls "C:\Windows\regedit.exe" /grant:r Administrators:RX
/grant:r - will set permissions (removing higher ones)
:RX - Read and Execute
답변2
이 명령은 관리자 그룹에 전체 권한을 부여한 후에만 작동합니다. 즉, 다음과 같습니다.
icacls c:\Windows\explorer.exe /grant Administrators:f
'수정'을 허용하는 것조차 어떤 이유로 충분하지 않은 것 같습니다.
답변3
답변에서 발견한 문제는 파일 소유자를 설정하려면 특별한 권한, 특히 "소유권 가져오기"가 필요하다는 것입니다. ACL 편집기 GUI가 어쨌든 소유자를 설정할 수 있는 이유는SeTakeOwnershipPrivilege
특권, 해당 액세스 확인을 재정의할 수 있습니다. 관리자로 실행되는 프로그램에는 이 권한이 있지만 사용하기 전에 명시적으로 활성화해야 하지만 실제로 icacls
는 그렇지 않습니다.
편리하게도 프로세스는 기본적으로 상위 프로세스의 권한을 상속하므로 호출하는 명령 프롬프트에 대해 해당 권한을 활성화할 수 있는 경우 icacls
유틸리티도 해당 권한을 활성화하고 소유자를 설정할 수 있습니다. 내 오픈 소스 유틸리티를 사용할 수 있습니다스프린트DLLSprintDLL의 상위 프로세스(명령 프롬프트)에서 권한을 활성화하기 위해 적절한 Win32 함수를 호출하려면:
SprintDLL call kernel32.dll!OpenProcess /return native /into prochandle (int 0x400, int 0, slotdata parentpid); newslot native token; call advapi32.dll!OpenProcessToken /return int (slotdata prochandle, int 0x20, slotptr token); newslot block luid = int 0, int 0; call advapi32.dll!LookupPrivilegeValueW /return int (nullptr, lpwstr "SeTakeOwnershipPrivilege", slotptr luid); newslot block privs = int 1, slotdata luid, int 2; call advapi32.dll!AdjustTokenPrivileges /return int (slotdata token, int 0, slotptr privs, slotsize privs as int, nullptr, nullptr)
icacls
작동하면 호출된 세 함수가 모두 1을 반환했다고 출력됩니다. 그런 다음 원래 시도한 대로 사용할 수 있습니다 .
답변4
이것은 64비트 시스템(및 내 문제)에서 나에게 효과적이었습니다...
icacls c:\Windows\SysWOW64\usercpl.dll /grant Administrators:f
icacls "C:\Windows\SysWOW64\usercpl.dll" /setowner "NT SERVICE\TrustedInstaller"
/setowner - 새 소유자