LuaSocket requires superuser to create server

385 Views Asked by At

When I try to create a socket listening on any port using LuaSocket on Ubuntu, the creation of the socket fails with "permission denied":

require("socket")

server, msg = socket.bind("*", 23)

if not server then print(msg) end

however, when the same script is executed as superuser (using sudo), creation of the server works just fine. Is there any reason why LuaSocket cannot normally create a server? Can I do anything (either in Lua or on the Ubuntu server) such that there is no need for executing the script as superuser?

1

There are 1 best solutions below

0
On BEST ANSWER

This is not LuaSocket specific problem, but a deliberate Ubuntu (and many other Linux/UNIX) security restriction. Non-privileged users cannot bind to ports under 1024. You can use privbind to work around this limitation.