1
As the title says, I'm looking for a way to limit SSH access to certain users, so that they can connect only during a certain time period.
Let's say, username "A" can access SSH only during office hours, username "B" can access SSH only after office hours, etc.
Not sure, but changing their login shell to a custom script might work. It will either
exec sh
at the end, or if it is the wrong time,exec false
. – Bobby – 2014-02-03T08:28:47.950@Bobby hmm... I suspected such... still hoping for a less 'hackish' method though... but thanks for reminding. – pepoluan – 2014-02-03T08:50:34.133
1In that case you might want to look into this. – Bobby – 2014-02-03T09:36:58.247
@Bobby - That links seems simple and good. But unfortunately that method is not working for me. – Unnikrishnan – 2014-02-03T10:19:35.067
A reasonable question, before suggesting an answer, is: what do you wish to do with those users who legged in before the curfew, but who are still there after curfew begins? – MariusMatutiae – 2014-02-03T11:07:07.283
@MariusMatutiae well, I wish I could maintain their connection, but if it is too complex to do so, an abrupt abort is acceptable. – pepoluan – 2014-02-03T12:07:55.520
@Bobby ahhh, thanks! That looks like what I need... I'll study more on pam conf's. – pepoluan – 2014-02-03T12:08:59.053