question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detect sshd service name or make configurable

See original GitHub issue

Handler:

- name: reload sshd configuration
  service:
    name: sshd
    state: reloaded

Fails with: Could not find the requested service sshd: host

On distros where the service name is ssh.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aarononealcommented, Feb 7, 2022

@lae

Release

lsb_release -d
Description:	Debian GNU/Linux 11 (bullseye)
uname -a
Linux node 5.13.19-3-pve #1 SMP PVE 5.13.19-7 (Thu, 20 Jan 2022 16:37:56 +0100) x86_64 GNU/Linux

Source

https://deb.debian.org/debian/dists/bullseye/main/installer-amd64/current/images/

Systemd

systemctl status sshd
Unit sshd.service could not be found.
systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: enabled)
0reactions
aarononealcommented, Feb 7, 2022

Good find! I didn’t realize that was handled with an alias.

It is also in my /lib/systemd/system/ssh.service file.

[Install]
WantedBy=multi-user.target
Alias=sshd.service

I see it was under Install, so I did this:

systemctl enable ssh.service

And now it works with the alias:

systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)

So it appears this would only be an issue for folks who don’t have SSH on boot enabled (an admittedly rare case).

Thank you for pointing me in the right direction.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sshd_config - How to Configure the OpenSSH Server?
Usually, this file is /etc/ssh/sshd_config , but the location can be changed using the -f command line option when starting sshd. Some organizations...
Read more >
OpenSSH Tip: Check Syntax Errors before Restarting SSHD ...
This page explains how to check the OpenSSH sshd server configuration file for syntax errors under Linux/Unix using the command-line option.
Read more >
OpenSSH Server configuration for Windows - Microsoft Learn
This article covers the Windows-specific configuration for OpenSSH Server (sshd). OpenSSH maintains detailed documentation for configuration ...
Read more >
Example: sshd - IBM
Use the netstat -a command and evaluate the output by looking for the SSHD jobname: # netstat -a ... SSHD 00000049 Listen Local...
Read more >
How to Enable and Configure SSH Server on Windows with ...
Set-Service -Name sshd -StartupType 'Automatic' Start-Service sshd. start sshd service on windows 10. Use the netstat command to make sure ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found