Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2200  / 2 Years ago, wed, january 26, 2022, 2:14:38

Is there a way to run a script on login irrespective of the shell? I would like to have something on the lines of the ssh login to an Ubuntu server - which displays the free RAM etc.



I understand that the welcome message itself is in /etc/motd, but the file seems to update on each login. How is this done? I do not want to use ~/.bashrc or ~/.profile and would like to have one for all users in the system by default.


More From » login

 Answers
5

Since you are asking for a "run for each login" versus "run at boot", this may be of help.



in the file /etc/login.defs
search for "fakeshell"
Here is the comment text for that parameter:



 # Instead of the real user shell, the program specified by this parameter
# will be launched, although its visible name (argv[0]) will be the shell's.
# The program may do whatever it wants (logging, additional authentification,
# banner, ...) before running the actual shell.
# FAKE_SHELL /bin/fakeshell


Be careful about any assumptions for your environment when using this approach. Define all your own paths for executables and data.


[#39480] Thursday, January 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tigehanc

Total Points: 162
Total Questions: 113
Total Answers: 122

Location: Zambia
Member since Sat, Oct 31, 2020
4 Years ago
;