Ask Your Question
0

How to keep sshd alive after restart?

asked 2014-01-10 22:36:24 -0600

das gravatar image

Every time I want to use ssh, I have to make it alive by issuing 'service sshd start' as superuser. In earlier versions of fedora, I would issue 'systemctl sshd on' as superuser, and this would keep sshd alive even after a restart. But, now, when I issue 'systemctl sshd on' as superuser, the system cannot recognize 'sshd'. Every time after reboot, I have to activate ssh once again through 'service sshd start' as superuser, or I cannot access this machine from any other machine on LAN.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2014-01-11 00:07:06 -0600

To start a service:

systemctl start $servicename

To enable a service to start on reboots:

systemctl enable $servicename

This syntax has never changed, and systemctl sshd on has never been correct. sshd should also be enabled by default.

edit flag offensive delete link more
0

answered 2014-01-11 07:59:49 -0600

das gravatar image

updated 2014-01-11 08:12:31 -0600

No ssh was not enabled in default. Now, as superuser I issued the following command:

[root@mamdo ~]# systemctl enable sshd ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'

I don't understand the creation of the symbolic link, and I am going to check now if sshd remains active on reboot.

Yes, I checked it after reboot with 'systemctl status sshd' as the superuser. Thank you for the help.

edit flag offensive delete link more

Comments

Yes, it worked. After reboot I checked with 'systemctl status sshd'.

das gravatar imagedas ( 2014-01-11 08:07:05 -0600 )edit

The purpose for the symbolic link, I believe, is to "link" the sshd.service file to a directory that systemd reads during bootup. By putting a service file in that directory, its considered "enabled".

radioact1ve gravatar imageradioact1ve ( 2014-01-11 09:28:35 -0600 )edit

Hello, I tried this solution, since I have the same problem, but I got this message: Failed to parse signal string /usr/lib/systemd/system/sshd.service. [ My system is Fedora20 ]

hookie gravatar imagehookie ( 2014-05-11 08:26:34 -0600 )edit

hookie, me too. So I tried to execute only the symbolic lynk part, and it worked! ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service' and then 'systemctl enable sshd' finally worked! Thank you for the solution.

Francesco Riggio gravatar imageFrancesco Riggio ( 2014-08-20 04:25:34 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-01-10 22:36:24 -0600

Seen: 1,407 times

Last updated: Jan 11 '14