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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-01-2007, 10: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, 12: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, 02:00 PM
|
#3
|
|
Moderator
Registered: May 2001
Posts: 24,790
|
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, 07:41 PM
|
#4
|
|
Senior Member
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,178
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:02 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
|
|