I’m trying to run my Scala code with SBT, but get the error below. This happens both with SBT using the command line and with IntelliJ Idea.
[error] (run-main) org.jboss.netty.channel.ChannelException:
Failed to bind to: /127.0.0.1:80
org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:80
....
....
Caused by: java.net.SocketException: Permission denied
What do I configure to allow port access. This happens both when I try to run on my local Mac and on my remote Ubuntu server.
Running sbt with “sudo sbt” fixes the problem, but this is not the solution. Where can I set permission to allow my Scala app to access port 80.
The solution to this problem will depend on the operating system, not on anything that SBT, Scala or Java might do.
For instance, Debian proposes three different solutions, all of which can be used on other Linux distributions — two of them are variations on running as root, and the third uses iptables to fake listening on port 80.
On FreeBSD one can disable the low port limitation entirely, and Solaris can do so per-port-and-user, as described (for both) here.