With our latest hardware/OS refresh, we implemented FQDN throughout our domain. We are now having a problem getting the correct prompt in our terminal sessions when we ssh into a remote site. This wouldn't be a problem except that we are often ssh'd into multiple sites and all the prompts are identical no matter which site we are connected to. Before implementing FQDN, we previously set the hostname of each sites gateway server to the sitename (site1, site2, etc...) and thus the login prompt allowed us to recognize which site we were connected to in each remote terminal session.
Now with RHEL 7 utilizing FQDN this is our hostname:
user1@site1:/home/user1 # hostnamectl status Static hostname: gwsrv.site1.system.division.company.com Pretty hostname: site1 Icon name: computer-server Chassis: server Machine ID: 988c77c116d744fb8b26629aab7beace Boot ID: b56bd8e144924560a9051dafbd2ac867 Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo) CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server Kernel: Linux 3.10.0-514.el7.x86_64 Architecture: x86-64
We modified the prompt using /etc/profile.d/profile.sh and it formats the prompt as expected:
PS1=`/usr/bin/whoami`@`/usr/bin/hostnamectl --pretty`:'$PWD # '
Which returns the prompt:
And if I elevate myself to root I get the same prompt:
user1@site1:/home/user1 # su Password: root@site1:/home/user1 #
But, if I change to any other users I get a different prompt:
user1@site1:/home/user1 # su user2 Password: [user2@gwsrv user1]$
It doesn't matter if I ssh in as any other user, my prompt for all users, except for user1 and root, give me this same prompt:
What file and which line do I need to modify to change this other prompt to resemble the prompt for user1 and root:
Specifically we need it to show that they are logged into the site not the gwsrv.
Thank you for your assistance.