Is it possible to display a different hostname, when a user logs in?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have an issue where my customer used a different hostname naming convention than my company did, for the devices they purchased from us. Example:



We named the devices Lenny1, so the FQDN is lenny1.whatever.com and user@Lenny1 is what is visible to users when they log in to the device.



The customer used the name PCAP02 for this same device. This creates confusion for users when they log in and see Lenny1 as the system name.



For very complex reasons, we cannot easily change the /etc/hosts file to use the names that our customer uses. My question is, is there a way to spoof the system name that the customer will see, when they log in? This change needs to be purely cosmetic, so that the users won't get confused about what system they're logging in to.







share|improve this question


























    up vote
    1
    down vote

    favorite












    I have an issue where my customer used a different hostname naming convention than my company did, for the devices they purchased from us. Example:



    We named the devices Lenny1, so the FQDN is lenny1.whatever.com and user@Lenny1 is what is visible to users when they log in to the device.



    The customer used the name PCAP02 for this same device. This creates confusion for users when they log in and see Lenny1 as the system name.



    For very complex reasons, we cannot easily change the /etc/hosts file to use the names that our customer uses. My question is, is there a way to spoof the system name that the customer will see, when they log in? This change needs to be purely cosmetic, so that the users won't get confused about what system they're logging in to.







    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have an issue where my customer used a different hostname naming convention than my company did, for the devices they purchased from us. Example:



      We named the devices Lenny1, so the FQDN is lenny1.whatever.com and user@Lenny1 is what is visible to users when they log in to the device.



      The customer used the name PCAP02 for this same device. This creates confusion for users when they log in and see Lenny1 as the system name.



      For very complex reasons, we cannot easily change the /etc/hosts file to use the names that our customer uses. My question is, is there a way to spoof the system name that the customer will see, when they log in? This change needs to be purely cosmetic, so that the users won't get confused about what system they're logging in to.







      share|improve this question














      I have an issue where my customer used a different hostname naming convention than my company did, for the devices they purchased from us. Example:



      We named the devices Lenny1, so the FQDN is lenny1.whatever.com and user@Lenny1 is what is visible to users when they log in to the device.



      The customer used the name PCAP02 for this same device. This creates confusion for users when they log in and see Lenny1 as the system name.



      For very complex reasons, we cannot easily change the /etc/hosts file to use the names that our customer uses. My question is, is there a way to spoof the system name that the customer will see, when they log in? This change needs to be purely cosmetic, so that the users won't get confused about what system they're logging in to.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 12 at 15:12









      0xC0000022L

      7,0831359105




      7,0831359105










      asked Apr 12 at 1:29









      GreNIX

      527




      527




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          You can change that in the /etc/bashrc file.



          Please make a backup of this file in case you make any mistakes.



          Within the file, you will see this line:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@h W]\$ "


          h is the hostname of the machine. Remove that and replace it with PCAP02.



          That line should then look like this:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@PCAP02 W]\$ "


          Save the file and enter bash and you will see user@PCAP02 in the terminal. Your customers will see the change when they SSH into the machines.






          share|improve this answer






















          • You are welcome. Glad to help.
            – Nasir Riley
            Apr 12 at 15:05










          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%2f437173%2fis-it-possible-to-display-a-different-hostname-when-a-user-logs-in%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
          4
          down vote



          accepted










          You can change that in the /etc/bashrc file.



          Please make a backup of this file in case you make any mistakes.



          Within the file, you will see this line:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@h W]\$ "


          h is the hostname of the machine. Remove that and replace it with PCAP02.



          That line should then look like this:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@PCAP02 W]\$ "


          Save the file and enter bash and you will see user@PCAP02 in the terminal. Your customers will see the change when they SSH into the machines.






          share|improve this answer






















          • You are welcome. Glad to help.
            – Nasir Riley
            Apr 12 at 15:05














          up vote
          4
          down vote



          accepted










          You can change that in the /etc/bashrc file.



          Please make a backup of this file in case you make any mistakes.



          Within the file, you will see this line:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@h W]\$ "


          h is the hostname of the machine. Remove that and replace it with PCAP02.



          That line should then look like this:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@PCAP02 W]\$ "


          Save the file and enter bash and you will see user@PCAP02 in the terminal. Your customers will see the change when they SSH into the machines.






          share|improve this answer






















          • You are welcome. Glad to help.
            – Nasir Riley
            Apr 12 at 15:05












          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          You can change that in the /etc/bashrc file.



          Please make a backup of this file in case you make any mistakes.



          Within the file, you will see this line:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@h W]\$ "


          h is the hostname of the machine. Remove that and replace it with PCAP02.



          That line should then look like this:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@PCAP02 W]\$ "


          Save the file and enter bash and you will see user@PCAP02 in the terminal. Your customers will see the change when they SSH into the machines.






          share|improve this answer














          You can change that in the /etc/bashrc file.



          Please make a backup of this file in case you make any mistakes.



          Within the file, you will see this line:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@h W]\$ "


          h is the hostname of the machine. Remove that and replace it with PCAP02.



          That line should then look like this:



          [ "$PS1" = "\s-\v\$ " ] && PS1="[u@PCAP02 W]\$ "


          Save the file and enter bash and you will see user@PCAP02 in the terminal. Your customers will see the change when they SSH into the machines.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 12 at 15:03

























          answered Apr 12 at 2:19









          Nasir Riley

          1,514138




          1,514138











          • You are welcome. Glad to help.
            – Nasir Riley
            Apr 12 at 15:05
















          • You are welcome. Glad to help.
            – Nasir Riley
            Apr 12 at 15:05















          You are welcome. Glad to help.
          – Nasir Riley
          Apr 12 at 15:05




          You are welcome. Glad to help.
          – Nasir Riley
          Apr 12 at 15:05












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f437173%2fis-it-possible-to-display-a-different-hostname-when-a-user-logs-in%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)