Other people log into my Raspberry Pi via SSH. It runs Ubuntu Mate 16.04 with OpenSSH. I want to disable some of the accounts but not delete them.
Now, I could just delete the passwords (which obviously has the disadvantage that a way to set the password, again, has to be found, unless I manually change the contents of the shadowfile which feels like a really bad idea) of the accounts I want to disable and rename their
~/.ssh/authorized_keys files to prevent them from logging in. However, I'd like there to be an error message on their consoles when they attempt to log in, describing why I disabled their accounts. The message is the same for all disabled accounts.
There seems to be an easy way to disable SSH login for entire groups which means that I can just add the users I want to disable to a certain group and disable SSH login for that group. However, this doesn't print them the message I want to be shown on their consoles.
I know how to put a message on the user's console once they logged in. But the goal, here, of course is that they don't get that far.
Because the users don't have physical access to my Raspberry Pi, I don't care whether the accounts are entirely disabled or it's just not possible to log into them via SSH. I don't care about the user switching to a different account via
su later on because only
root and my user account can do this, anyways.