On Mon, May 13, 2024 at 07:36:07AM +0200, Richard wrote: > .profile > will always be read as soon as the user logs in, no matter how. Through a > terminal, a GUI, doesn't matter.
That's not correct. There are many different GUI login setups where the .profile is never read. That said, since this thread is specifically about *root* logins, GUI logins may not be possible. It depends on which Display Manager and Desktop Environment are in use. Many of them explicitly disallow direct root logins. So, ultimately it comes down to what the OP actually requires, and what type of setup they use. If they only want this thing to happen when root logs in directly on a console or ssh, then .profile may indeed be the correct answer.