• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved SSH Welcome Banner - Not Showing

rhbk

New Pleskian
Hi,

Made yesterday a new and clean Onyx installation on a dedicated server using CentOS 7 Minimal. Installation seems to be done properly and and after a first check-up all seems to be working ok.

There is just one small issue related with the default SSH Welcome Banner that Onyx creates by default. The problem is that it does not show. I have made many other installations and this never happen.

Anyone knows why did this happen and how can I fix it?

Bellow are some informations that can be helpful to identify the cause of this issue:

a) Installation was made using manual partition with a dedicated /boot partition

b) Some commands I run on the server to try to identify the issue:

sudo grep PrintMotd /etc/ssh/sshd_config
#PrintMotd yes

sudo grep Banner /etc/ssh/sshd_config
#Banner none

sudo nano /etc/motd >> it's empty

Thanks
 
Hi rhbk,

in general, a line commented with an # in front, inside of configuration files, will not be used.

The "Plesk" banner configuration is setup at =>
Code:
/root/.plesk_banner
... and contains the following standart configuration:
Code:
cat /root/.plesk_banner
# This script is indirectly called by Bash on login shell startup.
# It outputs Plesk shell banner with login instructions.
# If you don't need it, you may comment out the following line.
/usr/lib/plesk-9.0/ssh-banner || :
 
Hi rhbk,
in general, a line commented with an # in front, inside of configuration files, will not be used.

Hi @UFHH01

Sorry but I did not understand your explanation. Can you please explain in a different/more simple way?

My /root/.plesk_banner file as the same contents as you posted.

Should not Onyx have setup the banner in a automatic way? Thanks
 
Hi rhbk,

Can you please explain in a different/more simple way?

Example at YOUR "/etc/ssh/sshd_config":
Code:
#PrintMotd yes
=> This line will be ignored, as there is # an in front of this line​
Example ( not ignored! ) at "/etc/ssh/sshd_config":
Code:
PrintMotd yes



In addition, pls. have a well a look at the file

=> /root/.profile

It should contain:
Code:
[ ! -s ~/.plesk_banner ] || . ~/.plesk_banner
 
Hi @UFHH01

Thanks for the explanation! I have removed the # on the /etc/ssh/sshd_config file making it PrintMotd yes.

When looking at the content of /root/.profile I run the command nano /root/.profile and the file does not exists.

Maybe that is the problem. File does not exist. What do you think? Thanks
 
Hi rhbk,

the standarts for individuell "root" configurations is either defined at

/root/.profile
or at
/root/.bash_profile

If none of these files exist on your server, just consider to create them, as it depends of your server installation, if these ( additional ) configuration files exist. ;)

The ones ( /root/.profile ) on my servers look like:
Code:
# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

mesg n || true

[ ! -s ~/.plesk_banner ] || . ~/.plesk_banner
 
Hi @UFHH01

Already create the files, reboot the server but still no welcome message when login using SSH. At /etc/ssh/sshd_config i removed the # to have: PrintMotd yes.

Bellow are the contents of the files you tld me to look. Do you know what is wrong?

/root/.profile

[ ! -s ~/.plesk_banner ] || . ~/.plesk_banner

Note: also tryied to put the /root/.profile with the same content as the the bellow /root/.bash_profile and also did not work.


/root/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

[ ! -s ~/.plesk_banner ] || . ~/.plesk_banner
 
Hi @UFHH01

Now the banner worked when I login using root directly. I was trying login using a sudo account.

So from what I see when I login directly as root the banner shows. If I login using a SUDO banner does not shows. Do you know how can I get the banner also to show when I login using a SUDO account?

Thanks
 
Hi rhbk,

if you desire to show the very same "plesk_banner", when you login with non - root - accounts, you simply would modify THEIR ".profile" / ".bash_profile" configuration files, to display the content of "/usr/lib/plesk-9.0/ssh-banner". ;)


But don't you rather want to display your VERY OWN "motd" for "non - root" - accounts, when they login?
If THIS is your case, you would edit the file "/etc/motd" and place inside, what ever you would like to be displayed, when a user logs into your server over SSH. ;)


... and IF you would like to display something BEFORE a user inserts the password, you would create a file like for example "/etc/own_ssh-banner", insert there what ever should be displayed and don't forget to change at "/etc/ssh/sshd_config":
Code:
Banner /etc/own_ssh-banner
instead of
Code:
#Banner none
 
Back
Top