[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to run automatically a script as soon root login



--> 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.

Yes,I don't need to run xorg and a desktop environment,since warp-cli disconnect and warp-cli connect do not require them.
I wouldn't to login as root automatically,but I've realized that this command :

echo 1 > /proc/sys/net/ipv4/ip_forward

work only if I'm root. It does not work using sudo. So,in the end I've chosen to be root instead of a normal user that can use sudo.

On Mon, May 13, 2024 at 1:24 PM Greg Wooledge <greg@wooledge.org> wrote:
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.



--
Mario.

Reply to: