I wrote a websocket server program running on Windows service.According to project needs, a DLL is called. This DLL needs to read my computer shagn a file under my document.However, the windows service program called DLL can succeed, but DLL failed to read the file under my document. When the server is not running as the windows service, DLL can read the files under my document successfully. I'm so depressed, I don't know why.Who can help me.Thank you
When several users using the same PC, each regular user have a My Document dir, and can't access other user's My Document.
When You run a service, it run by default as Local System or Local Service which are restrict users, and doesn't have access to your My Document dir.
You must think: how the service can choose from all other users in your PC which is the user it should take the file from?
The simple solution is to run the service as your user. You can try it manually by open the service Properties (on services, right click and choose Properties, or double click), choose Log On tab, and fill the acount username and password to your username and password.
A real solution is to place the file in a fixed place, like %LocalAppData%\AppName, not depending on any user.
Related
I'm working with WSO2 Identity Server and I'm curious if there is a way to run the product in developer mode without building each component of identity server. I found a way to start the "My Account" component in dev mode by following this tutorial ( https://is.docs.wso2.com/en/5.11.0/develop/setting-up-my-account-in-a-dev-environment/ )
but I want to be able to modify different components such as recovery-portal and authentication-portal by forking and cloning the required github repositories and starting the entire app in developer mode in order to see the code changes in real-time.
AFAIK the developer mode will work only for the MyAccount and Console. You can refer to the doc for more details on that.
The recovery portal, the authentication portal etc. cannot be tried with the developer mode. However, there are two ways that you can try this.
Build the war files manually and add them to the WebApps directory. If the server is running, war file changes will automatically get deployed. If the server is not running, you have to delete the existing directory and restart the server.
You can do the changes to the JSPs that are deployed inside the pack. Once the changes are done, you can save the changes and the changes will automatically get deployed.
I have C++ application running as service. And I want to start my NSIS installer silently from that service. Is it possible? If yes how can I achieve this?
If you want to start the installer as the same user as your service and this service runs at integrity level high or system then you can just use CreateProcess or ShellExecute to start the installer.
If you want to start the installer as a user that is currently logged in you need to use CreateProcessAsUser but things get complicated if you go this route. There might not be any logged in users or there might be more than one. Once you have decided which user you want to start the process as then you can get their token with WTSQueryUserToken.
This is on Mac 10.8
I have written Google Chrome Extension and a Native Messaging executable which communicates with the Chrome Extension using Native Messaging. All works fine with my Proof of Concept as part of development.
Issue is that now I want to get it deployed.
I have my in house installer which by which I need to create a com.my_company.my_product.json manifest file inside of this /Library/Google/Chrome/NativeMessagingHosts directory which cannot be accessed unless I ask for the password of the admin user.
I am doing this port as part of migration of NPPlugin to Chrome Extension Native messaging communication which will replace the NPPlugin. NPPlugin can be accessed from both /Library as well as ~/Library which does not require sudo permissions.
Why does the manifest file need to be at root /Library level ad not user ~/library level? If so how can we get this installed on a Mac without bothering the user with admin password which the user will obviously be less likely to share.
If anyone has a solution, the Native Executable is a C++ program that can use Mac API calls.
Your understanding is correct. The Chromium team is investigating user directories as an additional option. Ensuring continuing security is the primary concern. I'll update this answer when there's more to report. (Update 6/1/2014: see Rob W.'s comment to this answer)
I am writing an application on OSX by using Qt C++ that needs root privilege.
I believe I can get these needed privilege by displaying a dialog box prompting user name and password, something like this in XAMPP:
How this can be done? Am I have to build the form manually then use setuid, or is there already built in function on the SDK?
Originally, Apple provided a function 'AuthorizationExecuteWithPrivileges' that allowed an application to launch another with root privileges. This has since been deprecated for security reasons.
The dialog here is a bit misleading. Apple provides authorization services that launches the dialog under various different situations, but usually from an application having called the function AuthorizationCopyRights, after having setup rules in an authorization database (the file at /etc/authorization) and having created the Authorization reference with AuthorizationCreate.
Security on OSX is split between a security daemon, a security agent and applications. An application can restrict features using this system, or request authorisation for the user to enter credentials so it can launch a privileged application, which is what you need to do.
It's important to note that the dialog has not been presented by the application, but by the Security Agent, which is solely responsible for the security GUI. The daemon actually processes the authorization.
Apple's method for elevation is to have all applications run with Standard User rights and should a privileged task be required, then this must be factored out into a separate application which is registered to run with launchd and given the elevated privileges. The example Apple provides is SMJobBless.
While the calling code of the example is written in Objective-C, the important functions are just C functions in the SMJobBlessAppController.m file, most notably AuthorizationCreate to create an authorisation reference and the code in the Objective-C function blessHelperWithLabel:error: at the bottom of the file.
Begin with this help document on SMJobBless, which details the process.
Finally, if you're using Qt, you'll need to include Apple's Security framework for the required function calls. To do that, just add the following to your .pro file: -
QMAKE_LFLAGS += -F /System/Library/Frameworks/Security.framework/
LIBS += -framework Security
Sorry if my question is silly, but I have no experience at all with terminal server and am having a problem on how to store user preferences for an app.
The application was originally designed to run in individual, independent, computers. The installer has the option to install for all users or the current user but it always stores some xml in a subdirectory of the commonapp folder of the computer. It does store it here to be able to write to it later on under Windows vista upward.
Now, the company is running terminal server and the users don't have an independent computer anymore. They log into a session of terminal server and the administrator decides what software they can use. As the app is now, it installs in the server and offers all the users the same preferences from the commonapp. If the preferences are changed for an user, they all will have the change...
Please, could someone illustrate me on this? Initially, I though that by choosing 'to all users' when installing, the terminal server system would use the roaming folder of the user to store the preferences but I was wrong...
I don't know what users are going to use the app and cannot install directly to their folder either.
Is this a terminal server settings thing or do I have to write some code in the app that checks if the user has the xml in its folder and copy it and use it if it doesn’t?
Do not store application preferences in its directory. Instead, store it in user's roaming directory - use Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) (since you tagged the post as managed). Then it can be installed once, but run multiple times by multiple users and each of them will get his set of settings.