Disable port 6600 from the "outside"

Need help with MPD?
Post Reply
Colin

Disable port 6600 from the "outside"

Post 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

max
Forum team
Posts: 1108
Joined: January 15th, 2013, 3:43 pm

Re: Disable port 6600 from the "outside"

Post by max »


Colin

Re: Disable port 6600 from the "outside"

Post 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"

skidoo
Posts: 204
Joined: April 28th, 2013, 10:06 pm
Location: Western Germany

Re: Disable port 6600 from the "outside"

Post by skidoo »

Check for multiple bind_to_address entries in mpd.conf and restart daemon.

max
Forum team
Posts: 1108
Joined: January 15th, 2013, 3:43 pm

Re: Disable port 6600 from the "outside"

Post by max »

Show me the output of: "ss -tlnep|grep mpd" (run it as root)

Colin

Re: Disable port 6600 from the "outside"

Post 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:~ $

max
Forum team
Posts: 1108
Joined: January 15th, 2013, 3:43 pm

Re: Disable port 6600 from the "outside"

Post by max »

MPD doesn't use your configuration file.

max
Forum team
Posts: 1108
Joined: January 15th, 2013, 3:43 pm

Re: Disable port 6600 from the "outside"

Post 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

Colin

Re: Disable port 6600 from the "outside"

Post 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???

max
Forum team
Posts: 1108
Joined: January 15th, 2013, 3:43 pm

Re: Disable port 6600 from the "outside"

Post 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.

Colin

Re: Disable port 6600 from the "outside"

Post 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.

max
Forum team
Posts: 1108
Joined: January 15th, 2013, 3:43 pm

Re: Disable port 6600 from the "outside"

Post 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.

skidoo
Posts: 204
Joined: April 28th, 2013, 10:06 pm
Location: Western Germany

Re: Disable port 6600 from the "outside"

Post 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.

Colin

Re: Disable port 6600 from the "outside"

Post by Colin »

Hi skidoo,

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

Post Reply