[SOLVED] Ping a PC lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- braximo · 2012-04-16 00:43 Hello community! Googled it and i DIDN'T find it! I just want to know how to ping a PC using code. Thanks and more power! ---------------------------------------------------------------------- ludob · 2012-04-16 06:22 Synapse has a pingsend unit. http://www.ararat.cz/synapse/doku.php/download ---------------------------------------------------------------------- braximo · 2012-04-16 06:27 Thanks for the info! Never used it before and will try it. tnx ---------------------------------------------------------------------- theo · 2012-04-16 11:18 You should be aware that Ping requires root privileges on Linux afaik. ---------------------------------------------------------------------- Rails · 2012-04-16 12:46 Quote from: theo on April 16, 2012, 01:18:02 pmYou should be aware that Ping requires root privileges on Linux afaik. Not on my Debian boxes. I'm not sure why not, though. It seems like it should require root privileges. ---------------------------------------------------------------------- ludob · 2012-04-16 12:53 Quote from: Rails on April 16, 2012, 02:46:11 pmQuote from: theo on April 16, 2012, 01:18:02 pmYou should be aware that Ping requires root privileges on Linux afaik. Not on my Debian boxes. I'm not sure why not, though. It seems like it should require root privileges. You're probably talking about the ping command. Do ls -l /bin/ping and you probably see something like -rwsr-xr-x root root. The s means that a non root user executes ping with the setuid root (chmod +s). Sending a ping from code does require root privileges, even on debian. ---------------------------------------------------------------------- Rails · 2012-04-16 13:22 You're probably talking about the ping command. Do ls -l /bin/ping and you probably see something like -rwsr-xr-x root root. The s means that a non root user executes ping with the setuid root (chmod +s). Sending a ping from code does require root privileges, even on debian. Yep, it's setuid root. Edit:  But I still don't understand the reasoning behind making the ping command available to ordinary users, even if only via setuid. Apparently, a number of distros come that way.  Google doesn't provide a ready answer as to why. Anyway, this is a bit off topic, so I think I will drop the subject and just query a Linux sys admin I know. ---------------------------------------------------------------------- jack616 · 2012-05-22 11:20 ISP's like to get people to ping when they have (sigh) issues. Maybe someone somewhere thought it relatively safe to provide it in response to that? ---------------------------------------------------------------------- braximo · 2012-06-04 03:28 any suggestions on how will i execute pinghost with root previlages? thanks ---------------------------------------------------------------------- BigChimp · 2012-06-04 07:01 Policykit. http://wiki.lazarus.freepascal.org/Executing_External_Programs#Redirec ting_input_and_output_and_running_under_root ---------------------------------------------------------------------- braximo · 2012-06-04 08:37 correct me if im wrong, will i create another app to execute pkexec ? ---------------------------------------------------------------------- ludob · 2012-06-04 09:06 Quote from: braximo on June 04, 2012, 10:37:05 amcorrect me if im wrong, will i create another app to execute pkexec ? Sending ping from code requires root privileges on linux. So you run your complete app with root privileges (probably not a good idea unless your app does nothing else but pinging) or you launch an external program from your app to do the ping and request root privileges only for that program. ---------------------------------------------------------------------- braximo · 2012-06-04 09:32 ah OK thanks. Got it to work thanks ludob