Archive: Username and Password


Username and Password
I am trying to write an installer for a service, and I would like the service to be installed under the current user and not the system user. I've seen several plugins that handle services, and they need to username and password of the account to install the service to. Is there a way to get a user's username and password?


nsDialogs would be a good place to start. I wrote my first custom screen last week and fell completely in love with it. Much easier to use than the old InstallOptions.

You'll need to verify that the username and password are valid before you accept them, which you should do on the Leave function of your custom page.


I was hoping for a way of just getting them and not prompting the user. Is there a way to just look them up with some system call or registry entry?


username:
System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
DetailPrint "User name - $0"

to get the password you would probably have to bruteforce the SAM database lol


Not particularly. For one, the installing user probably isn't the one who will be running the service. Having a service run as a user with Administrative privileges is a really bad idea, because any flaw in your program will allow an attacker to smash the stack in your program and run their own code on the machine with administrator rights.

There's a system account with privileges less than an administrator that is a common choice, but I don't know the details of using it. The absolute safest option is to create your own user and run the service as that user. That user has extremely restricted privileges, so that even if miscreants hijack your service they'll be fairly restricted in what they can do.


Thanks for all the info everybody.