Is there a way to create an MOTD with login details?

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











up vote
3
down vote

favorite












Is there a way to display active SSH login details in the MOTD display? Like, I wanted to display the IP Address from where the connection got originated and how much time the session is active. Is this possible?



Additional Update:



# tty --silent && finger
Login Name Tty Idle Login Time Office Office Phone Host
root root pts/0 Jun 22 00:33 (192.168.2.2)
root root pts/1 Jun 22 00:38 (192.168.2.2)


Is there a way to remove Office & Office Phone from the above output so that it looks little more better? In addition, it just says at what time the user is logged in. Is there a way also to show how much time the user is logged in?







share|improve this question

























    up vote
    3
    down vote

    favorite












    Is there a way to display active SSH login details in the MOTD display? Like, I wanted to display the IP Address from where the connection got originated and how much time the session is active. Is this possible?



    Additional Update:



    # tty --silent && finger
    Login Name Tty Idle Login Time Office Office Phone Host
    root root pts/0 Jun 22 00:33 (192.168.2.2)
    root root pts/1 Jun 22 00:38 (192.168.2.2)


    Is there a way to remove Office & Office Phone from the above output so that it looks little more better? In addition, it just says at what time the user is logged in. Is there a way also to show how much time the user is logged in?







    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      Is there a way to display active SSH login details in the MOTD display? Like, I wanted to display the IP Address from where the connection got originated and how much time the session is active. Is this possible?



      Additional Update:



      # tty --silent && finger
      Login Name Tty Idle Login Time Office Office Phone Host
      root root pts/0 Jun 22 00:33 (192.168.2.2)
      root root pts/1 Jun 22 00:38 (192.168.2.2)


      Is there a way to remove Office & Office Phone from the above output so that it looks little more better? In addition, it just says at what time the user is logged in. Is there a way also to show how much time the user is logged in?







      share|improve this question













      Is there a way to display active SSH login details in the MOTD display? Like, I wanted to display the IP Address from where the connection got originated and how much time the session is active. Is this possible?



      Additional Update:



      # tty --silent && finger
      Login Name Tty Idle Login Time Office Office Phone Host
      root root pts/0 Jun 22 00:33 (192.168.2.2)
      root root pts/1 Jun 22 00:38 (192.168.2.2)


      Is there a way to remove Office & Office Phone from the above output so that it looks little more better? In addition, it just says at what time the user is logged in. Is there a way also to show how much time the user is logged in?









      share|improve this question












      share|improve this question




      share|improve this question








      edited Jun 21 at 19:12
























      asked Jun 21 at 13:52









      Gokulnath Kumar

      558




      558




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote













          You could display the current users with who or finger. To run one of them on login, you could add it to the users' shell's startup files. Assuming your users run Bash (or some other shell that reads /etc/profile), you could put something like this there:



          tty --silent && finger


          (tty finds out if the shell is open on a terminal. Without testing it, the output could mess up noninteractive utilities.)



          At least on Debian/Ubuntu, the default /etc/profile also runs scripts in /etc/profile.d/ (the files need to end with .sh), so you could put the command in a new file there, instead.




          In addition, Ubuntu has a system specifically for updating the MOTD file dynamically. The pam_motd module runs scripts in /etc/update-motd.d and stores their output in /etc/motd.dynamic, which is then shown to the user. In this case, it goes through the usual MOTD process, so you don't need to check for tty or anything. See e.g. update-motd(5) and the UpdateMotd page on Ubuntu wiki.






          share|improve this answer























          • Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
            – Gokulnath Kumar
            Jun 21 at 19:15










          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%2f451115%2fis-there-a-way-to-create-an-motd-with-login-details%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
          5
          down vote













          You could display the current users with who or finger. To run one of them on login, you could add it to the users' shell's startup files. Assuming your users run Bash (or some other shell that reads /etc/profile), you could put something like this there:



          tty --silent && finger


          (tty finds out if the shell is open on a terminal. Without testing it, the output could mess up noninteractive utilities.)



          At least on Debian/Ubuntu, the default /etc/profile also runs scripts in /etc/profile.d/ (the files need to end with .sh), so you could put the command in a new file there, instead.




          In addition, Ubuntu has a system specifically for updating the MOTD file dynamically. The pam_motd module runs scripts in /etc/update-motd.d and stores their output in /etc/motd.dynamic, which is then shown to the user. In this case, it goes through the usual MOTD process, so you don't need to check for tty or anything. See e.g. update-motd(5) and the UpdateMotd page on Ubuntu wiki.






          share|improve this answer























          • Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
            – Gokulnath Kumar
            Jun 21 at 19:15














          up vote
          5
          down vote













          You could display the current users with who or finger. To run one of them on login, you could add it to the users' shell's startup files. Assuming your users run Bash (or some other shell that reads /etc/profile), you could put something like this there:



          tty --silent && finger


          (tty finds out if the shell is open on a terminal. Without testing it, the output could mess up noninteractive utilities.)



          At least on Debian/Ubuntu, the default /etc/profile also runs scripts in /etc/profile.d/ (the files need to end with .sh), so you could put the command in a new file there, instead.




          In addition, Ubuntu has a system specifically for updating the MOTD file dynamically. The pam_motd module runs scripts in /etc/update-motd.d and stores their output in /etc/motd.dynamic, which is then shown to the user. In this case, it goes through the usual MOTD process, so you don't need to check for tty or anything. See e.g. update-motd(5) and the UpdateMotd page on Ubuntu wiki.






          share|improve this answer























          • Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
            – Gokulnath Kumar
            Jun 21 at 19:15












          up vote
          5
          down vote










          up vote
          5
          down vote









          You could display the current users with who or finger. To run one of them on login, you could add it to the users' shell's startup files. Assuming your users run Bash (or some other shell that reads /etc/profile), you could put something like this there:



          tty --silent && finger


          (tty finds out if the shell is open on a terminal. Without testing it, the output could mess up noninteractive utilities.)



          At least on Debian/Ubuntu, the default /etc/profile also runs scripts in /etc/profile.d/ (the files need to end with .sh), so you could put the command in a new file there, instead.




          In addition, Ubuntu has a system specifically for updating the MOTD file dynamically. The pam_motd module runs scripts in /etc/update-motd.d and stores their output in /etc/motd.dynamic, which is then shown to the user. In this case, it goes through the usual MOTD process, so you don't need to check for tty or anything. See e.g. update-motd(5) and the UpdateMotd page on Ubuntu wiki.






          share|improve this answer















          You could display the current users with who or finger. To run one of them on login, you could add it to the users' shell's startup files. Assuming your users run Bash (or some other shell that reads /etc/profile), you could put something like this there:



          tty --silent && finger


          (tty finds out if the shell is open on a terminal. Without testing it, the output could mess up noninteractive utilities.)



          At least on Debian/Ubuntu, the default /etc/profile also runs scripts in /etc/profile.d/ (the files need to end with .sh), so you could put the command in a new file there, instead.




          In addition, Ubuntu has a system specifically for updating the MOTD file dynamically. The pam_motd module runs scripts in /etc/update-motd.d and stores their output in /etc/motd.dynamic, which is then shown to the user. In this case, it goes through the usual MOTD process, so you don't need to check for tty or anything. See e.g. update-motd(5) and the UpdateMotd page on Ubuntu wiki.







          share|improve this answer















          share|improve this answer



          share|improve this answer








          edited Jun 21 at 16:35


























          answered Jun 21 at 14:03









          ilkkachu

          47.4k668130




          47.4k668130











          • Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
            – Gokulnath Kumar
            Jun 21 at 19:15
















          • Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
            – Gokulnath Kumar
            Jun 21 at 19:15















          Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
          – Gokulnath Kumar
          Jun 21 at 19:15




          Thank you for your answer. I have added some additional details in the question. Could you also help me with the same? Also, fedora based distribution doesn't come with finger tool installed and we will have to install it. is there any other alternate way so that we do not need to install any new utility..
          – Gokulnath Kumar
          Jun 21 at 19:15












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f451115%2fis-there-a-way-to-create-an-motd-with-login-details%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