su (switch user) application

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

su (switch user) application

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...
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: su (switch user) application

Michael Van Canneyt


On Mon, 7 Aug 2006, 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: su (switch user) application

Johannes Nohl
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: su (switch user) application

Michael Van Canneyt


On Tue, 8 Aug 2006, Johannes Nohl wrote:

> 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?

Baseunix.

See the documentation:

http://www.freepascal.org/docs-html/rtl/baseunix/fpsetuid.html

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: su (switch user) application

Johannes Nohl
> Baseunix.

Great! I found it. Is there a Windows-way, too? Something like
basewindows? Thanks...
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: su (switch user) application

Michael Van Canneyt


On Wed, 9 Aug 2006, 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal