A simple question, I've been looking everywhere and I couldn' find the answer : How can I limit my root account in Debian ? I need that the root have access only to one connection at a time in the terminal.
Any advice will be appreciated.
A simple question, I've been looking everywhere and I couldn' find the answer : How can I limit my root account in Debian ? I need that the root have access only to one connection at a time in the terminal.
Any advice will be appreciated.
Edit /etc/ssh/sshd_config
AllowUsers root@{serverIP}
Edit /etc/security/limits.conf
root hard maxlogins 1
If you want to have only one root
session in one time, you will have to implement some kind of reject script to be run after authentication. For this, the ForceCommand
option in sshd_config
is really useful.
The script can looks basically somehow like this:
ForceCommand users | grep root || $SSH_ORIGINAL_COMMAND
If ssh is not the concern, then you can put something like this into your .bashrc
or .profile
:
users | grep root && exit