Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Consider using sudo, EX:

coryj  ALL = NOPASSWD: /bin/ping

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) and sudoers(5).

share|improve this answer
    
Accepted this, seems a little cleaner then modifying the source, though modifying the source affords a little more granular control. Both good solutions. Personally I've been convinced to rethink my original reasons for doing this and accomplish my goals a different way. –  Cory J Jul 27 '10 at 19:27
add comment

You can modify the source code and change the behavior. You can make the default size bigger, it's on line 98 of ping.c in /usr/src/sbin/ping/. Or you can disable this feature on line 446 by replacing the line with if (0) {. After you change it, run make install.

I have to wonder why you would need a normal user to send a large ICMP message.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.