elevated-privileges

Windows force UAC elevation for files if their names contain “update”?

ぐ巨炮叔叔 提交于 2019-12-13 01:53:54
问题 I am using Windows 7 and Microsoft Visual Studio 2010. I created simple project with one MessageBox() call in WinMain() . The name of the project is "update" , so name of EXE file is update.exe . I have turned off manifest generation in Linker settings. But when I try to start debugging in Visual Studio, it says that my application requires elevation. I decided to start application by clicking on it in Windows Explorer, but it still requires administrator privileges. I renamed it to

Update Root Crontab with Objective C

丶灬走出姿态 提交于 2019-12-12 02:49:13
问题 Consider a third-party SDK with a command line application that needs to run as root on OSX. You build a Cocoa application in Objective C and have it installed in /Applications under the "root:wheel" (user: root, group: wheel) ownership. I already have that folder/file ownership working because my Installer application uses AppleScript to prompt for root and then does a chown and chmod for this. So, what is the preferred programmatic way then for the Cocoa application to update the root's

Execute several elevated commands in shell (or similar)

随声附和 提交于 2019-12-11 20:56:49
问题 I have a requirement to execute several commands with elevated rights, something like: call program that modifies a .config file of a service (needs admin rights) net stop myservice (needs admin rights) net start myservice (needs admin rights) All of this dynamic, e. g. the first line could contain proxy settings, including user name and password, or any other modification to the settings file. (Settings file is in program folder, program to modify the settings file is externally provided.

Adding [not just enabling] SeDebugPrivilege

时光怂恿深爱的人放手 提交于 2019-12-11 15:38:49
问题 Having a terrible problem with both IE and Firefox on Win7, a few minutes after cold start or after exiting sleep, beginning a minute or two of intense disk activity, shutting out all other processes, even stopping cursor movement. Can't get to Task Manager to identify culprit, though it has to be IE or Firefox. Want to write a program that watches processes and pauses any process that hijacks the machine. Can EnumProcesses but cannot do OpenProcess or other SeDebugPrivilege related functions

SE_SYSTEMTIME_NAME privilege does not exists

半腔热情 提交于 2019-12-11 10:28:50
问题 I am trying to change the system time from a user account (not from admin account) on windows7 machine. In order to change the system time, it is mentioned in this link that we need to have SE_SYSTEMTIME_NAME privilege. Here is my python script. import os,sys import win32api import win32security priv_flags = win32security.TOKEN_ADJUST_PRIVILEGES | win32security.TOKEN_QUERY hToken = win32security.OpenProcessToken (win32api.GetCurrentProcess (), priv_flags) privilege_id = win32security

Sharepoint query with elevated privileges

天涯浪子 提交于 2019-12-11 09:04:58
问题 A Webpart needs to access a Sharepoint List (read mode). If the user is admin, there isn't problem (works as espected), but if the user hasn't permissions to access, I must use "RunWithElevatedPrivileges" method. The problem is that seems that the query don't return the correct results. What I'm missing? SPList demoList = null; SPSecurity.RunWithElevatedPrivileges(delegate() { SPSite oSite = SPControl.GetContextSite(HttpContext.Current); // ADDED SPWeb oWeb = oSite.OpenWeb(); // ADDED

Run python script as admin in windows

霸气de小男生 提交于 2019-12-11 04:24:49
问题 I have a script that removes and substitute some files in C:\Windows directory. I start command line as admin then I start my python script in it. And when the script tries to remove files from C:\Windows , I get WindowsError error 5 . How can I fix this? Possible solution: Actually I was trying to modify files which has all privileges only for TrustedInstaller user, so I used this https://github.com/jschicht/RunAsTI to run python script. 回答1: WindowsError error 5 occurs when you have no

How reliable is adding an application manifest to ensure elevated privileges across windows xp, vista and 7?

蹲街弑〆低调 提交于 2019-12-11 03:33:54
问题 How stable is this method to ensure that my admin application requests admin privileges when launching: <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> This works well on Windows 7 but I do not have access to XP and Vista so cannot tell. 回答1: By specifying that manifest, you tell Windows (Vista or 7), if a standard user (admin as well with UAC enabled) tries to execute this app, UAC

Make an HTA file run as admin (elevated)

大兔子大兔子 提交于 2019-12-10 17:32:23
问题 In wsf, vbs and js files you can easily find out if they run elevated and if not you can easily make them. The code I've written for that is this: EnsureElevatedPrivileges(); WScript.Echo("Running elevated now!"); function EnsureElevatedPrivileges() { if (!WScript.Arguments.Named.Exists("elevate")) { new ActiveXObject("Shell.Application").ShellExecute(WScript.FullName, "\"" + WScript.ScriptFullName + "\" /elevate", "", "runas", 1); WScript.Quit(); } } But this doesn't work in HTA files

setuid/setgid wrapper for python script

北城余情 提交于 2019-12-10 13:54:01
问题 I have a Python script that I wish to be able to be run as the system user guybrush with UID 200 and group guybrush with GID 200. At the moment my Python script (located in /path/to/script.py ) looks like this: #!/usr/bin/env python2 import os print "uid: %s" % os.getuid() print "euid: %s" % os.getgid() print "gid: %s" % os.geteuid() print "egid: %s" % os.getegid() My attempted C wrapper ( scriptwrap.c ) looks like this: #include <unistd.h> #include <sys/types.h> int main(int argc, char *argv