Page 1 of 1

Disable port 6600 from the "outside"

Posted: February 17th, 2020, 6:30 pm
by Colin
it is possible to disable access to port 6600 from the network. So that it can only be accessed from the host itself? I already have a localhost in /etc/mpd.conf at address. But that doesn't work

Best regards,
Colin

Re: Disable port 6600 from the "outside"

Posted: February 17th, 2020, 6:39 pm
by max

Re: Disable port 6600 from the "outside"

Posted: February 18th, 2020, 5:26 pm
by Colin
Hi Max,

Sorry, I still doesn’t see it. I’m also not very good on linux. I have on my /etc/mpd.conf on a raspberry the setting below. Normal (windows) if you bind to local host this means IP 127.0.0.1 and ::1 And that is what I have on the config below. But it is still listen to all IP addresses. Or does this works different on linux

Code: Select all

# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address. Not effective if systemd socket
# activation is in use.
#
# For network
bind_to_address		"localhost"
#
# And for Unix Socket
#bind_to_address		"/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
port				"6600"

Re: Disable port 6600 from the "outside"

Posted: February 18th, 2020, 10:28 pm
by skidoo
Check for multiple bind_to_address entries in mpd.conf and restart daemon.

Re: Disable port 6600 from the "outside"

Posted: February 19th, 2020, 8:12 am
by max
Show me the output of: "ss -tlnep|grep mpd" (run it as root)

Re: Disable port 6600 from the "outside"

Posted: February 19th, 2020, 5:31 pm
by Colin

Code: Select all

pi@raspberry:~ $ sudo ss -tlnep|grep mpd
LISTEN    0         5                        *:6600                   *:*        users:(("mpd",pid=480,fd=4),("systemd",pid=1,fd=33)) ino:9731 sk:4 v6only:0 <->
pi@raspberry:~ $

Re: Disable port 6600 from the "outside"

Posted: February 19th, 2020, 8:33 pm
by max
MPD doesn't use your configuration file.

Re: Disable port 6600 from the "outside"

Posted: February 20th, 2020, 7:46 am
by max
How do you start MPD? Do you have to use the systemd socket?
If yes, read this: https://www.musicpd.org/doc/html/user.h ... activation

Re: Disable port 6600 from the "outside"

Posted: February 20th, 2020, 9:48 am
by Colin
Yes you are right systemd socket was active. So I have disabled it with

sudo systemctl stop mpd.socket
sudo systemctl disable mpd.socket

But now I have to enable systemd so it use the config file /etc/mpd.conf. And start mpd when the raspberry start.

When I run "sudo systemctl --user start mpd" I get the message “Failed to connect to bus: No such file or directory”

If I try to use "sudo systemctl enable mpd.service" it looks like it still use mpd.socket if I see the output below.

Synchronizing state of mpd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mpd
Created symlink /etc/systemd/system/sockets.target.wants/mpd.socket → /lib/systemd/system/mpd.socket.

And if I run "sudo ss -tlnep|grep mpd" it still listening to al addresses.

The question is what am I doing wrong???

Re: Disable port 6600 from the "outside"

Posted: February 20th, 2020, 12:00 pm
by max
Why did you disable the systemd socket? Why not just change the listener settings in the systemd socket?

Why do you run "systemctl --user" with "sudo"? That doesn't make any sense. There's no "root" login session, you want your regular user's login session, and thus you shouldn't use "sudo".

And... SysV service script? What's that? Where does that come from?

I'm confused by your choices.

Re: Disable port 6600 from the "outside"

Posted: February 20th, 2020, 2:32 pm
by Colin
When I run "sudo systemctl --user start mpd" I get the message “Failed to connect to bus: No such file or directory” And the help says "In this configuration, MPD will ignore the listener settings (bind_to_address and port)."

And couldn't find any settings for the systemd socket. So I thought I had to switch. If you can tell me where I can find the config for systemd socket to set bind address to localhost then I'm going to try that.

Re: Disable port 6600 from the "outside"

Posted: February 21st, 2020, 1:30 pm
by max
Read the systemd documentation, this is not a MPD specific thing. If you don't want to learn about systemd, don't use its socket activation feature.

Re: Disable port 6600 from the "outside"

Posted: February 22nd, 2020, 8:55 pm
by skidoo
Oh joy of systemd :D

@Colin> Have a look at https://wiki.archlinux.org/index.php/Mu ... yer_Daemon - MPD acts different if started as root or user.

Re: Disable port 6600 from the "outside"

Posted: February 23rd, 2020, 10:55 am
by Colin
Hi skidoo,

Thank you for your answer. It's solved now.