In the man page for FreeBSD ping:
-s packetsize Specify the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data. Only the super-user may specify val- ues more than default. This option cannot be used with ping sweeps.
Does anyone know how I can let non-superusers send pings larger then 56? Can I increase the default size, or somehow allow -s to be used by non-root users? I am aware of the security implications, that this could allow users to start a ping flood, so if I can restrict this to allowing only a single (shell-less) user, all the better.
You can modify the source code and change the behavior. You can make the default size bigger, it's on line
98
ofping.c
in/usr/src/sbin/ping/
. Or you can disable this feature on line446
by replacing the line withif (0) {
. After you change it, runmake install
.I have to wonder why you would need a normal user to send a large ICMP message.
Consider using sudo, EX:
This should let user
coryj
run/bin/ping
(caveat: using any args he likes, not just-s
) without a password.Note the security implications of this; see man pages for
sudo(8)
andsudoers(5)
.