[systemd-devel] systemd services via SSH (-H key)

Jan Alexander Steffens jan.steffens at gmail.com
Thu Oct 22 14:50:40 PDT 2015


On Thu, Oct 22, 2015 at 11:07 PM, Mikhail Kasimov
<mikhail.kasimov at gmail.com> wrote:
> Hello!
>
> 1. systemd services have a special key (-H) to connect to remote host
> via ssh. E.g. 'timedatectl -H user at host'. By default port 22 is used.
> But in very often cases admins change the default ssh-port in
> sshd-daemon settings (e.g. 41122). It's useful to avoid connections from
> ssh-bruteforce robots.
> But systemd has no way (I can't find it in man-pages for example) how to
> define the admin-defined ssh connection port (possibly, other ssh
> options are also not accessable).

You can use ~/.ssh/config to alter any connection properties
associated with a certain hostname, even directing the connection to a
completely different host (a way of creating aliases).

Example:

Host foo
  HostName foo.example.com
  User bar
  Port 41122

and henceforth, `timedatectl -H foo` will connect to bar at foo.example.com:41122


More information about the systemd-devel mailing list