Except that a knowledgeable user will comment out the line from the
.bash_profile or .profile and no longer have this restriction!

A better approach is to write a script that looks up the user and his/her
information from a configuration file and decides on whether the user is
allows or not allowed to logon.

This script can then be used as the shell in the /etc/passwd file.

Something like this...(this is pseudocode..)

#! /bin/bash
if (/sbin/scripts/checkusr) then
        exec /bin/bash
else
        echo "Not allowed to login at this time"
        exec /bin/false
endif

# /sbin/scripts/checkusr is the script you need to write to check if the
# if the currently logged in user is allowed to login at this time.
# Return true if user is allowed to login. Return false otherwise

-Naren


On Fri, 7 Dec 2001, USM Bish wrote:

> On Thu, Dec 06, 2001 at 06:55:52AM +0000, Chandra Sekhar wrote:
> >  
> >  i was working on linux shell programming and i want to control 
> >  my users. my requirements are:
> >
> >  1)i have to give permission for certain time say from 10 to 12 
> >    am to a user. later if he tries to login, it should not work.
> >    ie a message will be displayed saying this is not u r time.
> >
> >  2) is this program must be executed  all the time or it can be 
> >     invoked at that particular incident only
> ---end quoted text---
> 
> Possible.
> 
> Use a bash script to be called from .bash_profile (in case you
> have a xdm/ kdm/ gdm login enabled). No need to  run in daemon
> mode ...
> 
> HTH
> 
> Bish
> 
> --
> :
> ####[ Linux One Stanza Tip (LOST) ]###########################
> 
> Sub : Lesser known commands (toe)                    LOST #212
> 
> To know what all terms are supported by the kernel use:
> $toe | less 
> This info may  be needed when telnetting to another host with
> a different OS which does not recognise linux as TERM type.
> 
> ####<[EMAIL PROTECTED]>####################################
> :
> 
> _______________________________________________
> linux-india-help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/linux-india-help
> 



_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to