Bash prompt changes for different users
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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:
user1@site1:/home/user1
#
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:
[user#@gwsrv ~]$
What file and which line do I need to modify to change this other prompt to resemble the prompt for user1 and root:
[user#@site1 ~]$
Specifically we need it to show that they are logged into the site not the gwsrv.
Thank you for your assistance.
bash login prompt
add a comment |Â
up vote
0
down vote
favorite
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:
user1@site1:/home/user1
#
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:
[user#@gwsrv ~]$
What file and which line do I need to modify to change this other prompt to resemble the prompt for user1 and root:
[user#@site1 ~]$
Specifically we need it to show that they are logged into the site not the gwsrv.
Thank you for your assistance.
bash login prompt
2
Is your PS1 assignment being overriden by a~/.bash_profile
,~/.bash_login
, or~/.profile
in the offending users'$HOME
?
â Kevin Kruse
May 17 at 17:40
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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:
user1@site1:/home/user1
#
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:
[user#@gwsrv ~]$
What file and which line do I need to modify to change this other prompt to resemble the prompt for user1 and root:
[user#@site1 ~]$
Specifically we need it to show that they are logged into the site not the gwsrv.
Thank you for your assistance.
bash login prompt
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:
user1@site1:/home/user1
#
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:
[user#@gwsrv ~]$
What file and which line do I need to modify to change this other prompt to resemble the prompt for user1 and root:
[user#@site1 ~]$
Specifically we need it to show that they are logged into the site not the gwsrv.
Thank you for your assistance.
bash login prompt
asked May 17 at 16:58
PCnetMD
6
6
2
Is your PS1 assignment being overriden by a~/.bash_profile
,~/.bash_login
, or~/.profile
in the offending users'$HOME
?
â Kevin Kruse
May 17 at 17:40
add a comment |Â
2
Is your PS1 assignment being overriden by a~/.bash_profile
,~/.bash_login
, or~/.profile
in the offending users'$HOME
?
â Kevin Kruse
May 17 at 17:40
2
2
Is your PS1 assignment being overriden by a
~/.bash_profile
, ~/.bash_login
, or ~/.profile
in the offending users' $HOME
?â Kevin Kruse
May 17 at 17:40
Is your PS1 assignment being overriden by a
~/.bash_profile
, ~/.bash_login
, or ~/.profile
in the offending users' $HOME
?â Kevin Kruse
May 17 at 17:40
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
Configurations in /etc/profile
can (and often will) be overridden by a user's own settings in their home directories (e. g. ~/.bash_profile
). Short of somehow implementing a regime that prevents a user from setting PS1
within their own environment, there's not really a way you can mandate a user has a specific prompt.
You could do something like grep 'PS1=' /home/*/.*
to find the likely candidates that change things, but that will not necessarily be exhaustive.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Configurations in /etc/profile
can (and often will) be overridden by a user's own settings in their home directories (e. g. ~/.bash_profile
). Short of somehow implementing a regime that prevents a user from setting PS1
within their own environment, there's not really a way you can mandate a user has a specific prompt.
You could do something like grep 'PS1=' /home/*/.*
to find the likely candidates that change things, but that will not necessarily be exhaustive.
add a comment |Â
up vote
2
down vote
Configurations in /etc/profile
can (and often will) be overridden by a user's own settings in their home directories (e. g. ~/.bash_profile
). Short of somehow implementing a regime that prevents a user from setting PS1
within their own environment, there's not really a way you can mandate a user has a specific prompt.
You could do something like grep 'PS1=' /home/*/.*
to find the likely candidates that change things, but that will not necessarily be exhaustive.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Configurations in /etc/profile
can (and often will) be overridden by a user's own settings in their home directories (e. g. ~/.bash_profile
). Short of somehow implementing a regime that prevents a user from setting PS1
within their own environment, there's not really a way you can mandate a user has a specific prompt.
You could do something like grep 'PS1=' /home/*/.*
to find the likely candidates that change things, but that will not necessarily be exhaustive.
Configurations in /etc/profile
can (and often will) be overridden by a user's own settings in their home directories (e. g. ~/.bash_profile
). Short of somehow implementing a regime that prevents a user from setting PS1
within their own environment, there's not really a way you can mandate a user has a specific prompt.
You could do something like grep 'PS1=' /home/*/.*
to find the likely candidates that change things, but that will not necessarily be exhaustive.
answered May 17 at 17:59
DopeGhoti
40k54779
40k54779
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f444429%2fbash-prompt-changes-for-different-users%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
Is your PS1 assignment being overriden by a
~/.bash_profile
,~/.bash_login
, or~/.profile
in the offending users'$HOME
?â Kevin Kruse
May 17 at 17:40