[fpc-pascal] [SYSTEM]: How detecting if run as root ?

Andrew Haines AndrewD207 at aol.com
Thu Oct 12 02:37:42 CEST 2006


TOUZEAU DAVID wrote:
> Dear
> 
> I need to detect if the program is executed as root privileges on Linux
> system.
> Did somebody had developped a such function ??
> 
> Best regards.
> 
> 
Well you can try GetEnv('USER') = 'root'; or GetEnv('UID') = '0'; but
there may be better ways to check this.

Andrew



More information about the fpc-pascal mailing list