Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-08

su (switch user) application

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Johannes Nohl

Does anyone know how to write a program which can change its user privileges on runtime? Like the suexec wrapper of apache?

Thanks for help...

Michael Van Canneyt
to Johannes Nohl
Johannes Nohl wrote
Does anyone know how to write a program which can change its user privileges on runtime? Like the suexec wrapper of apache? Thanks for help...

This is not possible unless it runs as root.
(which can be forced by setting the executable file setuid root)

In that case you can use the fpSetUID call.
This call can be used only once.

Michael.

Johannes Nohl
to Michael Van Canneyt

Hello!

In that case you can use the fpSetUID call. This call can be used only once.

Thanks for your help. But I never saw this function. Can you tell me which unit it is in?

Johannes

Michael Van Canneyt
to Johannes Nohl
Johannes Nohl wrote
> Baseunix. Great! I found it. Is there a Windows-way, too? Something like basewindows? Thanks...

As far as I know, there is no way to change the user-id of a running process. It is possible to start a process with a different set of credentials; This mechanism (CreateProcessEx or CreateProcess or so) could be used to start the same process once more with the desired credentials.

Michael.