restricting users during certain times/days

  • Follow


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?
0
Reply mikecoxlinux (646) 2/2/2004 10:27:46 PM

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.

-- 
Lew Pitcher
IT Consultant, Enterprise Technology Solutions
Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employers')
0
Reply Lew.Pitcher (530) 2/2/2004 9:03:47 PM


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
0
Reply USENET22 (5462) 2/2/2004 9:37:03 PM

Mike Cox <mikecoxlinux@yahoo.com> wrote:
> In article <vtfmvb.9ug.ln@news.heiming.de>, "Michael Heiming"
> <michael+USENET@www.heiming.de> wrote:

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

> PAM is way too hard and confusing.  I can't figure it out so I need to

Read the doc that usually comes with pam: "README.pam_time"

There's nothing confusing about it.

-- 
Michael Heiming - RHCE

Remove +SIGNS and www. if you expect an answer, sorry for 
inconvenience, but I get tons of SPAM
0
Reply USENET22 (5462) 2/2/2004 10:12:33 PM

In article <vtfmvb.9ug.ln@news.heiming.de>, "Michael Heiming"
<michael+USENET@www.heiming.de> wrote:

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

PAM is way too hard and confusing.  I can't figure it out so I need to
avoid it at all cost.   LDAP and PAM are still the scariest items in the
Linux world to configure.  Even sendmail is a good puppy compared to
those programs.
0
Reply mikecoxlinux (646) 2/2/2004 11:58:32 PM

4 Replies
53 Views

(page loaded in 0.091 seconds)


Reply: