Closed eat-sleep-code closed 1 year ago
Looking over the init script, it's presumably because vlc runs unprivileged as the "pi" user which does not have access to use port 80.
Stretching back into distant memory, I recall vlc didn't like running as root and it would probably be a terrible idea anyway.
Best answer I can find is to use setcap
to allow the vlc
binary access to port 80:
sudo apt-get install libcap2-bin
sudo setcap 'cap_net_bind_service=+ep' /usr/bin/vlc
That could be coupled with this changeset to make changing port/pass easier:
diff --git a/projects/vlc-radio/vlcd/usr/bin/vlcd b/projects/vlc-radio/vlcd/usr/bin/vlcd
index 374233b..f7515b3 100755
--- a/projects/vlc-radio/vlcd/usr/bin/vlcd
+++ b/projects/vlc-radio/vlcd/usr/bin/vlcd
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
+HTTP_PORT=8080
+HTTP_PASS=raspberry
+
sudo mkdir -p /var/run/vlcd
if [ -n $(cat /etc/passwd | grep -w "pi:") ]; then
@@ -18,6 +21,10 @@ else
playlist="/etc/vlcd/default.m3u"
fi
+if [ -f /etc/vlcd/config ]; then
+ source /etc/vlcd/config
+fi
+
volpref=$(grep "^alsa-gain" ~/.config/vlc/vlcrc)
if [ -z $volpref ]; then
@@ -43,7 +50,7 @@ fi
--intf dummy \
--extraintf rc:http \
--rc-host 0.0.0.0:9294 --rc-fake-tty \
---http-host 0.0.0.0 --http-port 8080 --http-password raspberry \
+--http-host 0.0.0.0 --http-port $HTTP_PORT --http-password $HTTP_PASS \
--no-quiet \
--daemon \
--pidfile /var/run/vlcd/vlcd.pid \
And the config file would look something like this:
cat projects/vlc-radio/vlcd/etc/vlcd/config
HTTP_PORT=80
HTTP_PASS=raspberry
I would like to change the port for VLC web interface to 80 but that does not seem possible. I changed the config in /usr/bin/vlc but then it wasn't accessible on 80 or 8080. I switched it back and then it was accessible on 8080. So it seems that it is the correct file to edit but there is something blocking.usage of port 80.
This was installed on a fresh install of Raspbian Buster Lite.