Sign in Join

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

Mailing lists / fpc-pascal / 2005-03

Check root privs

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Michaÿffffb3 Woÿffff9fniak

Hi there.

First of all, I am new here and would like to say
"Hello" to all you guys on this list.

Now the question:
I am developing a simple program under Linux, that is to use RAW sockets. Therefore it *requires* root
priviledges.
Does anyone know how to check for them _before_ I get an AV trying to send using a RAW socket? :)
[Obviously, I handle the exception, but I need to tell the user they need root privs]

TIA
Mike

Send instant messages to your online friends http://uk.messenger.yahoo.com

Reply by email

Michael Van Canneyt
to Michaÿffffb3 Woÿffff9fniak
Show quoted text 13 lines
Hi there. First of all, I am new here and would like to say "Hello" to all you guys on this list. Now the question: I am developing a simple program under Linux, that is to use RAW sockets. Therefore it *requires* root priviledges. Does anyone know how to check for them _before_ I get an AV trying to send using a RAW socket? :) [Obviously, I handle the exception, but I need to tell the user they need root privs]

Normally, you can do getuid or geteuid to get the user ID, if it is zero, you know it's the root user.

Michael.

Reply by email