I’d like mopidy to listen on port 80 so users can avoid typing ‘http://musicServer:6680’, and instead just type ‘http://musicServer’. But linux only allows root to listen on ports < 1024. Is there some way to give user mopidy privileges to use port 80?
I’m running mopidy as a service. Here’s my config file:
pi@pynet ~ $ sudo cat /etc/mopidy/mopidy.conf
[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /var/log/mopidy/mopidy-debug.log
[local]
enabled = true
data_dir = /var/lib/mopidy/local
media_dir = /var/lib/mopidy/media
playlists_dir = /var/lib/mopidy/playlists
[http]
enabled = true
hostname = 0.0.0.0
port = 80
Here’s the mopidy log file
2015-11-28 22:04:27,738 ERROR [6319:MainThread] mopidy.commands: Frontend (HttpFrontend) initialization error: HTTP server startup failed: [Errno 13] Permission denied
2015-11-28 22:04:27,754 INFO [6319:MainThread] mopidy.commands: Initialization error. Exiting..
I found that you can “remap” ports using the iptables command, like so:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 6680
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 6680
but was hoping for a more secure option, since the above allows any user access to port 80.