Re: restricting users during certain times/days

From: Michael Heiming (michael+USENET_at_www.heiming.de)
Date: 02/02/04


Date: Mon, 2 Feb 2004 22:37:03 +0100

Lew Pitcher <Lew.Pitcher@td.com> wrote:
> On Mon, 02 Feb 2004 14:27:46 -0800, "Mike Cox" <mikecoxlinux@yahoo.com> wrote:

> >Is it possible to control the times or days a user is allowed to login?
> >For example, if you only want a user to be able to login during the
> >weekdays. How would you set that up?

> Depending on how universal I wanted the restriction, I'd probably set up a
> couple of cron jobs
> 0 0 * * mon touch /etc/nologin
> 0 0 * * sat rm /etc/nologin

> see nologin(5) ("man 5 nologin") for details on what the /etc/nologin file does.

Yep, but then we are on a multi-user system, your approach might
be a bit dramatic and none might be able to login. I'd change
users shell to /sbin/nologin via 'usermod' from cron. Albeit, one
needs to make sure (log him off) that the user isn't still logged
in while the cron job runs.

However there's AFAIK even a pam module available for something
like this? The OP should check in addition the PAM docs.

-- 
Michael Heiming
Remove +SIGNS and www. if you expect an answer, sorry for 
inconvenience, but I get tons of SPAM


Relevant Pages

  • Re: Testers wanted for krb5 / gssftpd graylisting changes
    ... My preference would be a PAM module. ... at the authentication (login) stage and I hope everything taking ... IPtables seems to me to be at too low a level. ... I have a script that I use to manually ban IP ...
    (Fedora)
  • Re: user setup question
    ... I did something like this using a pam module which looked at the tty that ... In my case I was also interested in not allowing users to login from ... the Internet but still be allowed to login from the internal network. ...
    (freebsd-questions)
  • Re: user setup question
    ... I did something like this using a pam module which looked at the tty that ... In my case I was also interested in not allowing users to login from ... the Internet but still be allowed to login from the internal network. ...
    (freebsd-questions)
  • Re: Restrict login account to SU access only???
    ... "Michael Vilain " writes: ... >run cron jobs but not login. ... because for "su" you need a valid password. ... >login but I don't know about su or cron. ...
    (comp.sys.sun.admin)
  • Re: How to Restrict a user, not a root, Login to the Console?
    ... We have a PAM module that will ... restrict remote logins on a per user basis. ... they'll have to login as themselves and then SU to the account. ... > I want that any users who try to remotely log in to this system must first log in with their personal user login, and then use the su command to become a application user. ...
    (Focus-SUN)