Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-01-2007, 11:02 AM
|
#1
|
LQ Newbie
Registered: Oct 2006
Posts: 1
Rep:
|
how to restrict a user logging with particular time
hi
i need to know how to set user login times that is for eg
a user USER1 has login access only between 10 am to 4 pm,
which configuration file i need to modify, send me suggesstions
at alagesh146@gmail.com
|
|
|
08-01-2007, 01:03 PM
|
#2
|
LQ Newbie
Registered: Nov 2006
Posts: 5
Rep:
|
In order to lock and unlock a user's periodically, make two 'cron'-directories:
# mkdir /etc/cron.lockuser
# echo "/usr/sbin/usermod -L USER1" > /etc/cron.lockuser/lockuser1
# chmod a+x /etc/cron.lockuser/lockuser1
# mkdir /etc/cron.unlockuser
# echo "/usr/sbin/usermod -U USER1" > /etc/cron.unlockuser/unlockuser1
# chmod a+x /etc/cron.unlockuser/unlockuser1
end then edit the file /etc/crontab with two extra lines:
00 10 * * * root run-parts /etc/cron.unlockuser
00 16 * * * root run-parts /etc/cron.lockuser
This will enable the password for USER1 from 10.00h until 16.00h. If the user uses another type of authentication to log in, you may want to change the lockuser1 and unlockuser1 files in another way:
# echo "/usr/bin/chsh -s /sbin/nologin USER1" > /etc/cron.lockuser/lockuser1
# chmod a+x /etc/cron.lockuser/lockuser1
# echo "/usr/bin/chsh -s /bin/bash USER1" > /etc/cron.unlockuser/unlockuser1
# chmod a+x /etc/cron.unlockuser/unlockuser1
this worked for me
regards
|
|
|
08-01-2007, 03:00 PM
|
#3
|
Moderator
Registered: May 2001
Posts: 29,415
|
How about PAM? As in /etc/security/time.conf?
And no we don't do email, that's just too lazy of you.
|
|
|
08-01-2007, 08:41 PM
|
#4
|
Senior Member
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181
Rep:
|
I know some sysadmins that just change the loginshell to "nologon" during times said user is not supposed to be active, of course taking account of the original shell type so they can be restored correctly.
|
|
|
All times are GMT -5. The time now is 11:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|