The executable that’s actually opening the port is the BEAM VM. Start iex in one window, then run ps aux | grep beam
in another to see the details of the process. In my case, the executable is /usr/lib/erlang/erts-7.2/bin/beam.smp
. Try setting the capabilities on that file instead.
Update: confirmed on Ubuntu 14.04.
$ sudo setcap 'cap_net_bind_service=+ep' /usr/lib/erlang/erts-7.2/bin/beam.smp
$ iex
Erlang/OTP 18 [erts-7.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.2.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :gen_tcp.listen(443, [])
{:ok, #Port<0.1426>}
iex(2)>