2

On a Linux machine, I am trying to run the udhcpc command as non-root. I am getting the error udhcpc: socket: Operation not permitted. Is there any way to execute udhcpc as a simple user in Linux?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175

1 Answers1

1

A dhcp client needs to bind an ICMP socket, and that requires root permissions¹. You can give a specific user permission to run dhcp through sudo. Run visudo to add a line like this to the configuration (joe is the name of the user to authorize):

joe ALL = (root) /sbin/udhcpc

¹ Or the appropriate capability, but they're not widespread yet.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175