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.
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.
No comments:
Post a Comment