1

I am trying a Slackware 14.2. I can start sshd by /etc/rc.d/rc.inet1 sshd start but my question is how to add service to run at boot on slackware linux? Basically how to permanently add services to system on Slackware Linux and also check that service status. So far I am able to achieve the above using this link,

$ sudo nano /etc/rc.d/rc.M

and adding these lines

# Start the sshd server
if [ -x /etc/rc.d/rc.sshd ]; then
  . /etc/rc.d/rc.sshd
fi

and it did work and ssh server started automatically after boot as I was able to ssh to that system but how to check that service status within the system other than ps aux | grep ssh or netstat -lntp | grep ssh or using tools like lsof? What I meant is some thing usual way like sudo service sshd status or sudo systemctl status sshd .

1
  • Oops! I should have known that systemd and openrc/init walks through their separate paths. Dec 28, 2018 at 16:27

2 Answers 2

2

Slackware use the BSD-style init system. sshd daemon is handled on boot with rc.inet2 script and is handled on shutdown with rc.0 and rc.6 on reboot.

To start sshd daemon on boot add execute permission to rc.sshd script:

chmod +x /etc/rc.d/rc.sshd

To disable sshd on boot remove execute permission:

chmod -x /etc/rc.d/rc.sshd

In alternative you can manage sshd daemon (stop&start and restart) using the rc script:

sh /etc/rc.d/rc.sshd
usage /etc/rc.d/rc.sshd start|stop|restart
3
  • Cool, just one more thing to complete the answer, how to check that service status? And that will make the answer eligible to be accepted. Jan 25, 2019 at 11:38
  • The rc.sshd script dont' provide a facility to check SSH server status. Other rc script provide the status argument for checking the service status: ` # sh /etc/rc.d/rc.docker status Status of dockerd: running ` Jan 28, 2019 at 11:40
  • 1
    yeah, that's why I accepted the answer without it :) Jan 28, 2019 at 13:23
2

Any services or daemons that use the network should be started from [/etc/rc.d/rc.inet2]. Most of the rc scripts in charge of starting daemons like inetd, sshd, bind, nfs, etc get called from rc.inet2. - Source http://www.slackware.com/config/network.php

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .