PS1 prompt based on who logged inPopulate PS1 asynchronouslyHow can I change screen's hardstatus color based...

Euro sign in table with siunitx

Balm of the Summer Court fey energy dice usage limits

Why Is Sojdlg123aljg a Common Password?

What's in a druid's grove?

How to measure the statistical "distance" between two frequency distributions?

Where on Earth is it easiest to survive in the wilderness?

Why did Tony's Arc Reactor do this?

Meaning of "Right Out" in Context

These roommates throw strange parties

"syntax error near unexpected token" after editing .bashrc

Entering the US with dual citizenship but US passport is long expired?

Supervisor wants me to support a diploma-thesis SW tool after I graduated

Looking for the comic book where Spider-Man was [mistakenly] addressed as Super-Man

How could a planet have one hemisphere way warmer than the other without the planet being tidally locked?

Can Adventure creatures always be cast from exile?

Dissuading my girlfriend from a scam

Temporarily simulate being offline programmatically

Remaining in the US beyond VWP admission period

Why did Boris Johnson call for new elections?

Fantasy Military Arms and Armor: the Dwarven Grand Armory

Can my imp familiar still talk when shapshifted (to a raven, if that matters)?

In apex, how to replace the value in the string

GFI outlets tripped after power outage

Was Rosie the Riveter sourced from a Michelangelo painting?



PS1 prompt based on who logged in


Populate PS1 asynchronouslyHow can I change screen's hardstatus color based on the logged in user?Non-printing escape sequence: when?How to change the color scheme of the prompt based on user?Is there a way to execute code in the command line prompt (PS1) without using backticks?Set custom environment to root user from normal user (sudo -i)Bash prompt changes for different usersSwitching a user using “su” gives me only the $ prompt






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I've got a nice PS1 prompt that I want to only be used when user 'gatty' uses su for root.



PS1='[e[32m]#[e[37m] '



When other users like 'george' etc login, I want them to get the standard PS1 instead of 'gattys'.



Is this possible, how would I go about doing this?



Thanks!










share|improve this question







New contributor



gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




























    1















    I've got a nice PS1 prompt that I want to only be used when user 'gatty' uses su for root.



    PS1='[e[32m]#[e[37m] '



    When other users like 'george' etc login, I want them to get the standard PS1 instead of 'gattys'.



    Is this possible, how would I go about doing this?



    Thanks!










    share|improve this question







    New contributor



    gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      1












      1








      1








      I've got a nice PS1 prompt that I want to only be used when user 'gatty' uses su for root.



      PS1='[e[32m]#[e[37m] '



      When other users like 'george' etc login, I want them to get the standard PS1 instead of 'gattys'.



      Is this possible, how would I go about doing this?



      Thanks!










      share|improve this question







      New contributor



      gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I've got a nice PS1 prompt that I want to only be used when user 'gatty' uses su for root.



      PS1='[e[32m]#[e[37m] '



      When other users like 'george' etc login, I want them to get the standard PS1 instead of 'gattys'.



      Is this possible, how would I go about doing this?



      Thanks!







      bash






      share|improve this question







      New contributor



      gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 51 mins ago









      gattygatty

      62 bronze badges




      62 bronze badges




      New contributor



      gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      gatty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          1 Answer
          1






          active

          oldest

          votes


















          0
















          In root's .bashrc, check the contents of /proc/self/loginuid, and set your custom PS1 variable only if it equals your UID.






          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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });







            gatty is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded
















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f539297%2fps1-prompt-based-on-who-logged-in%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            In root's .bashrc, check the contents of /proc/self/loginuid, and set your custom PS1 variable only if it equals your UID.






            share|improve this answer






























              0
















              In root's .bashrc, check the contents of /proc/self/loginuid, and set your custom PS1 variable only if it equals your UID.






              share|improve this answer




























                0














                0










                0









                In root's .bashrc, check the contents of /proc/self/loginuid, and set your custom PS1 variable only if it equals your UID.






                share|improve this answer













                In root's .bashrc, check the contents of /proc/self/loginuid, and set your custom PS1 variable only if it equals your UID.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 38 mins ago









                Joseph SibleJoseph Sible

                1,4813 silver badges13 bronze badges




                1,4813 silver badges13 bronze badges


























                    gatty is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded

















                    gatty is a new contributor. Be nice, and check out our Code of Conduct.













                    gatty is a new contributor. Be nice, and check out our Code of Conduct.












                    gatty is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f539297%2fps1-prompt-based-on-who-logged-in%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...