4

Whenever I log into my RHEL8 server via SSH, I get these lines printed:

Web console: https://<myserver>:9090/ or https://<myip>:9090/

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register

How do I disable those prompts?

cyqsimon
  • 255
  • 2
  • 10

2 Answers2

6

I figured it out before I finished writing this question so I figured I'd just share this with anyone else.

# ls /etc/motd.d -lh
total 0
lrwxrwxrwx. 1 root root 17 Mar 12 19:46 cockpit -> /run/cockpit/motd
lrwxrwxrwx. 1 root root 41 Jun 18 22:01 insights-client -> /etc/insights-client/insights-client.motd

Each one of those symlinks prints something to the SSH terminal on login. In this case, cockpit prints the web console message and insights-client prints the insights prompt.

Therefore just do this:

# cd /etc/motd.d
# [sudo] rm -f cockpit insights-client

Verified to work and persist across restart on RHEL8.4.

cyqsimon
  • 255
  • 2
  • 10
1

As this is caused mainly by the pam_motd.so PAM module the better approach is to comment it out in file /etc/pam.d/sshd, changing the line from

session    optional     pam_motd.so

to

# session    optional     pam_motd.so

After restarting the SSH daemon via

systemctl restart sshd

the messages will not be displayed, as well not MOTD a second time.

The configuration could be done via an Ansible task

- name:  Make sure that it is removed Web console message on user login in RHEL 8
  lineinfile:
    path: /etc/pam.d/sshd
    regexp: '^session    optional     pam_motd.so'
    line: '# session    optional     pam_motd.so'

or via CLI and sed

sed -i 's/session    optional     pam_motd.so/# session    optional     pam_motd.so/g' /etc/pam.d/sshd
# or more generic
sed '/session    optional     pam_motd.so/s/^/# /g' /etc/pam.d/sshd

Further Documentation

U880D
  • 1,017
  • 2
  • 12
  • 18