一个简单的问题,我一直在寻找,我无法find答案:我怎样才能限制我的root帐户在Debian中? 我需要root在一个terminal中只能访问一个连接。
任何build议将被认真考虑。
编辑/etc/ssh/sshd_config
AllowUsers root@{serverIP}
编辑/etc/security/limits.conf
root hard maxlogins 1
如果你想一次只有一个root
会话,你将不得不实现某种拒绝脚本在authentication后运行。 为此, sshd_config
的ForceCommand
选项非常有用。
脚本可以看起来像这样:
ForceCommand users | grep root || $SSH_ORIGINAL_COMMAND
如果不关心ssh,那么你可以在你的.bashrc
或.profile
:
users | grep root && exit