We help IT Professionals succeed at work.

Time limits to access Linux SMB share

KestasS
KestasS asked
on
Hello,

How could I implement time limits to access Linux resources ? I use Linux SuSE 7.2 with SAMBA 2.2

Thanks,

Kestutis
Comment
Watch Question

Gns
BRONZE EXPERT

Commented:
What kind of timelimits are you aiming at? Fixed hours? All use? In that case, simply add a cron-job to stop/start samba. My SuSE install (7.1 on sparc) is dead ATM, so I can't check the specifics, but isn't there a rc.smb (or similar) that you could use?
Simply do (as root)
crontab -e

and add two lines something like the following:
0 6 * * 1-5 <substitute with command to START samba>
0 18 * * 1-5 <substitute with command to STOP samba>

which would keep samba active between 06.00 and 18.00 on weekdays.

If that wasn't "it", please be a bit more verbose about what you are looking for.

-- Glenn

Author

Commented:
Thank you, Glenn, for your comment.

I would like to give acces for some users groups to SAMBA shared directories only during working hours.  However I could not stop SAMBA server as others users will not be able to work with their resources.  Also I would like to force logout users from SAMBA if their work during not work hours.

It is like in Novell Netware server or Micorosft NT Server.

Sorry if I am not clear :)

Kestutis
Gns
BRONZE EXPERT

Commented:
Hm, I thought that might be it. I've never seen any setting that would let youdo that, but... it shouldn't be too hard to dream up a shellscript that would "emulate" the functionality.

Whilst I read docs, and "dream on":-), you might find something usefull at http://www.samba.org

-- Glenn
BRONZE EXPERT
Commented:
... after close to 1.5 years of dreaming....
One thing you might do, if you use an smbpasswd file, is to maintain two such files. One for the daytime, and one for the rest... and have a cron job stop the samba server, swap the files, restart the server ... mornings and nights.
I havent' tested this, so I don't know how it will effect "already logged in" clients, when their credentials suddely go away... Might work OK:-).

-- Glenn (Who is looking through the real old unlocked questions he has commented in)

Author

Commented:
I think also that is is a right direction. But I have already finished with developing the server at that direction. Let  younger colleagues develop that :)

Thank you for your attention !
Kestas

Explore More ContentExplore courses, solutions, and other research materials related to this topic.