FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Run an other program as different user
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Run an other program as different user
Posted: Wed Apr 23, 2025 11:46 AM

Hi,

I need to run another program with a different user/password , than my program, from my program.

That other program have to have other right to access a server to get data, but that user/password,can't access the things that my program is using...

Is that possible?

It's something as the RUNAS-dos-command,but that one ask me the password.

Thanks

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 12:05 PM

If I understood correctly:

There is a general user directory on the server

Full name, password, rights fields

If you run the program from your program, then all this can be passed as parameters

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 12:21 PM

No, my program can access everything from the PC.

The other user can only access data from another (OPC)-server. Only that user has access to get data from that system.

My program will call the other program(with other credentials), and that program return data(it place data on a specific place that my program can access) , that my program will use.

The reason why only that other user can access the other server, is that this is used in a chemical plant, and the normal user may not access the other server. They give me a login than I can use in my program to access that data, but the users may not know the user/password

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 12:27 PM

So, specifically, it doesn't work ?

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 01:01 PM
In the info of the runas-command:
Enter the password when prompted. The RunAs program demands that you type the password manually. This was a conscious design decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure
There is a possibility to use the /savecred, but the I have to enter the password manualy one time.

I see that the runas() function in Autoit can handle passwords. I will try it.
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 01:14 PM

RunAs - 'is this the FW or Clipper function ? If you want to enter the password automatically, then find the handle of the window and the item on it. And enter the password(sendmessage) in this element

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 01:25 PM

No, runas.exe is standard Microsoft commandline-program located in %windir%\System32\runas.exe...

I see that there are different alternative programs for it.

I will try those.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion