Is there a way to create an MOTD with login details?
Clash 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?
linux ssh motd
add a comment |Â
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?
linux ssh motd
add a comment |Â
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?
linux ssh motd
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?
linux ssh motd
edited Jun 21 at 19:12
asked Jun 21 at 13:52
Gokulnath Kumar
558
558
add a comment |Â
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
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%2f451115%2fis-there-a-way-to-create-an-motd-with-login-details%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