2

I have a xinetd service from Centos6 and I want to port to Centos7 ie create a systemd service

# cat /etc/xinetd.d/br_rsh 
# default: on
# description: The rshd server is the server for the rcmd(3) routine and, \
#   consequently, for the rsh(1) program.  The server provides \
#   remote execution facilities with authentication based on \
#   privileged port numbers from trusted hosts.
service brshell
{
    port            = 591
    socket_type     = stream
    wait            = no
    user            = root
    log_on_success      += USERID
    log_on_failure      += USERID
    server          = /usr/sbin/in.br_rshd
    disable         = no
}

If i understood correctly, i need to break down the above file to two parts: one for brshell.socket and another for brshell.service. Then, I need to execute systemctl enable brshell.socket (what about brshell.service?)

What would these files look like and Where would these files go under?

Thank you

2

I'm assuming you already know about all the risks involved in running rshd, so I'll skip the "dire warnings" section of my talk. :-)

If your distribution includes the program that you're running, there's a strong chance that it already has the correct systemd files to migrate to (/usr/lib/systemd/system is where the distribution-supplied units files are located in CentOS IIRC. This is distro-specific; for example, I use Gentoo so they're located in /lib/systemd/system for me.)

If you need to make the unit files, it's pretty easy to migrate an xinetd service. You are correct in that you need both a socket and service file. By default, they both have the same base name; however, that's not a requirement, just a simplification. For your particular case, put the following into /etc/systemd/system (this is where you should put unit files that you create yourself):

brshell.socket

[Unit]
Description=rsh Server Socket

[Socket]
ListenStream=591
Accept=yes

[Install]
WantedBy=sockets.target

brshell.service

[Unit]
Description=rsh Server Daemon
After=network.target

[Service]
ExecStart=/usr/sbin/in.br_rshd

[Install]
WantedBy=multi-user.target

That's basically it! All you need to do next is run systemd enable brshell.socket (to have it start automatically at boot) and systemd start brshell.socket.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.