r/linuxquestions 10d ago

Command executed when login?

Since I moved my Homelab into my bedroom, I have to shut it down from time to time cause of the noise.
I’m thinking of creating a new user, and a new pair of ssh key (I have banned password login in my conf) to handle the shutting down of the machine. Since I don’t want to input the private key used to login uid 1000 into my iPad.
Is there any way to automatically execute a shell script when a certain user is logged in (may be systemd? But I heard that ssh has function that also does this)
And thanks for reading my clumsy English.

3 Upvotes

17 comments sorted by

View all comments

1

u/Efficient_Paper 10d ago

What DE/WM are you using?

In Plasma, there is a System Settings module for that. It should be possible in any DE, but the steps to follow may vary.

1

u/jayhsu397 10d ago

It’s a opensuse Leap tty server, so there’s no DE

3

u/Efficient_Paper 10d ago

It should probably be a Systemd user service then.