4

Every time someone connects with SSH, systemd prints this to the syslog:

Jan 21 09:53:54 server systemd[1]: Created slice User Slice of UID 1002.
Jan 21 09:53:54 server systemd[1]: Starting User Runtime Directory /run/user/1002...
Jan 21 09:53:54 server systemd[1]: Started User Runtime Directory /run/user/1002.
Jan 21 09:53:54 server systemd[1]: Starting User Manager for UID 1002...
Jan 21 09:53:55 server systemd[16973]: Listening on GnuPG cryptographic agent and passphrase cache.
Jan 21 09:53:55 server systemd[16973]: Reached target Paths.
Jan 21 09:53:55 server systemd[16973]: Listening on GnuPG cryptographic agent and passphrase cache (access for web browsers).
Jan 21 09:53:55 server systemd[16973]: Reached target Timers.
Jan 21 09:53:55 server systemd[16973]: Listening on GnuPG network certificate management daemon.
Jan 21 09:53:55 server systemd[16973]: Listening on GnuPG cryptographic agent and passphrase cache (restricted).
Jan 21 09:53:55 server systemd[16973]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jan 21 09:53:55 server systemd[16973]: Reached target Sockets.
Jan 21 09:53:55 server systemd[16973]: Reached target Basic System.
Jan 21 09:53:55 server systemd[16973]: Reached target Default.
Jan 21 09:53:55 server systemd[16973]: Startup finished in 81ms.
Jan 21 09:53:55 server systemd[1]: Started User Manager for UID 1002.

This is excessive and unhelpful. How can I disable some of these messages?

I've seen people filtering them out by string matching, but that's just a hack. Surely there should be a verbosity setting somewhere? It's not clear which program is responsible though - is it systemd? ssh? Something else?

1
  • Those messaged don't come from the SSHD daemon, who generates them? I've no idea. Commented Jan 21, 2022 at 10:44

1 Answer 1

3

As root, try installing an override to the system service

systemctl edit sshd.service

or edit the distribution file

vi /etc/systemd/system/sshd.service

In the former case, you just need to add the overridden directive

[Service]
LogLevelMax=4

If editing the whole file, you will find the entire Service recipe

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755

to which you'll add the LogLevelMax directive.

(log level goes from 0 - emergency - to 6 - debug chatter).

At this point you reload the config and restart the service:

systemctl daemon-reload
systemctl restart sshd.service

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.