Bash prompt changes for different users

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|improve this question















  • 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














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.







share|improve this question















  • 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












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.







share|improve this question











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.









share|improve this question










share|improve this question




share|improve this question









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












  • 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










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.






share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    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






























    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.






    share|improve this answer

























      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.






      share|improve this answer























        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.






        share|improve this answer













        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.







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered May 17 at 17:59









        DopeGhoti

        40k54779




        40k54779






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            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













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay