Score:0

Memcached can not listen on a port different from 11211 in Alma Linux 8.8

ru flag

I installed successfully Memcached in Alma Linux 8.8 (a Red Hat 8.8 clone) but, when I changed the port number from 11211 to 11212 in the config file at /etc/sysconfig/memcached and restarted the service, I got the following message:

failed to listen on TCP port 11212: Permission denied

Other port numbers (11213, 11214, etc.) don't work either!

I am running a Vagrant machine (downloaded from the official repository of Alma Linux) on VirtualBox 7.0.8

Updates: after reading asktyagi note, I changed the port number to 11213 and restarted the service. I've got this on cockpit:

SELinux access control errors

SELinux is preventing /usr/bin/memcached from name_bind access on the tcp_socket port 11213.

Solution: If you want to allow /usr/bin/memcached to bind to network port 11213 you need to modify the port type.

Solution details: semanage port -a -t memcache_port_t -p tcp 11213

Audit log:

type=AVC msg=audit(1690420222.524:28): avc: denied { name_bind } for pid=778 comm="memcached" src=11213 scontext=system_u:system_r:memcached_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0

asktyagi avatar
in flag
What audit or secure logs says?
aldemarcalazans avatar
ru flag
Hi. I changed the port number to 11213 and caught some new messages. I will update the post with them.
Score:1
in flag

SELinux is preventing port to bind. Execute below command to allow it from selinux side.

semanage port -a -t memcache_port_t -p tcp 11213

Other way is disable selinux, relabel it and retry.

aldemarcalazans avatar
ru flag
I executed the command suggested for ports 11212, 11213, 11214 and 11215 and it worked!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.