pypxe / PyPXE

Pure Python PXE (DHCP-(Proxy)/TFTP/HTTP/NBD) Server
MIT License
547 stars 125 forks source link

Use effective UID for system access #157

Closed lathama closed 7 years ago

lathama commented 7 years ago

Using Effective UID in the case that user has been granted access to operate as UID 0. Currently there is a warning and then a failure to bind to port for TFTP which I can note in an issue. Without TFTP running it starts fine.

$ PYTHONPATH='/home/user/sandbox/PyPXE' python pypxe/server.py --no-tftp

WARNING: Not root. Servers will probably fail to bind.

2017-06-29 12:20:25,997 [INFO] PyPXE PyPXE successfully initialized and running! ^C Shutting down PyPXE...

$ PYTHONPATH='/home/user/sandbox/PyPXE' python pypxe/server.py

WARNING: Not root. Servers will probably fail to bind.

2017-06-29 12:20:33,387 [INFO] PyPXE Starting TFTP server... Traceback (most recent call last): File "pypxe/server.py", line 325, in main() File "pypxe/server.py", line 238, in main ip = args.TFTP_SERVER_IP) File "/home/user/sandbox/PyPXE/pypxe/tftp.py", line 243, in init self.sock.bind((self.ip, self.port)) File "/usr/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 13] Permission denied $