You cannot "easily" port the binary to other os/distro's, there can be a
library / processor or gcc issue.

Shell script can easily be ported to others distros !

And moreover, a script is always preferred than a binary

HTH

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Anshul
Sent: Friday, February 18, 2005 1:07 AM
To: [email protected]
Subject: Re: [ilug-cal] Login expiration

Well, whats wrong with writing a simple suid C program and calling it
from etc/profile with the user id as an argument.  Its simple,
straight froward and does exactly what is wanted in this situation.

Anshul

On Fri, 18 Feb 2005 00:15:08 +0530, Rajiv Lodha <[EMAIL PROTECTED]>
wrote:
> Hello,
> 
> You just need to schedule a script to be executed at a certain interval of
> time (say 1 min).
> 
> The logic -
> 
> Using "w" (or who) you can get login name, time logged in.
> $w
> 
> Grab the output, and in a for loop, use grep to take the username from
this
> and then try this - (Don't forget to check the username for root !)
> 
> You have the time logged in and userid, check the system time ... and if
the
> difference is one hour .. continue the steps below or move to next userid
> 
> $ps -u "userid"
> 
> it will list the process id(s) for all processes which belongs to the
> particular user.
> 
> Pid   TTY   TIME   CMD
> 1730 tty1 00:00:00   X
> 6610 tty1 00:00:00   bash
> 
> Here "X" is the GUI Interface for the particular user
> And bash is the normal CUI.
> 
> Now use kill -9 to terminate these process
> $kill -9 1730
> $kill -9 6610
> 
> Try these commands on the shell and then and see what happens.
> 
> Warning - Check the man docs, first learn how to disable cron jobs and
then
> use cron.
> 
> PS - Please don't use this to annoy your colleagues! ;-)
> 
> HTH
> 
> Regards,
> Rajiv
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of linuxprosun
> Sent: Thursday, February 17, 2005 5:13 PM
> To: [email protected]
> Subject: Re: [ilug-cal] Login expiration
> 
> No, as far I know, cron don't bother about the login done or not, and I
> want to logout the person just after the 1hr, after (s)he logs in, not on
> around the clock basis. I used cron and found that if user logs in last
> minute of the cron schedule, then (s)he logs out just after 1min, from
> his/her log on. Thanks for your reply, please give me more suggestions.
> 
> waiting
> prosun
> 
> On Mon, 14 Feb 2005 08:08:50 +0530, Rajiv Lodha <[EMAIL PROTECTED]>
> wrote:
> 
> > instead of "C" program, you can write a unix shell script ... make  a
> > smart use of CRON(TAB), we used to do this with our fellow students at
> > our institue.
> >
> > but instead of 1 hr ... we did the same for 1 min ;-)
> >
> > He He He.
> >
> > rajiv
> >
> >
> >
> >
> > On Mon, 14 Feb 2005 05:16:29 +0530, Anshul <[EMAIL PROTECTED]>
> > wrote:
> >> On Sun, 13 Feb 2005 13:09:21 +0530, Manas Laha
> >> <[EMAIL PROTECTED]> wrote:
> >> >
> >> > Abhijit Banerjee wrote:
> >> >
> >> > >prosun try this
> >> > >in bashrc add at the end
> >> > >
> >> > >sleep 3600
> >> > >logout
> >> > >
> >> > >
> >> > Won't work, unfortunately! All this will do is block the terminal for
> >> > one hour and then log the user out. Not quite what Prosun desires.
> >> >
> >> > Also, any modifications made to the user's .bashrc or .bash_profile
> >> can
> >> > be undone by the user any time in the one hour available to him. So,
> >> the
> >> > modifications should be made to the system-wide /etc/profile file.
> >> This
> >> > file, along with the user's own .bash_profile and .bashrc are read in
> >> > during every login.
> >> >
> >> > Here's an outline of what _probably_ has to be added in /etc/profile
> >> in
> >> > order to achieve what Prosun desires:
> >> >
> >> > 1. The process-id of the user's login shell has to be obtained.
> >> > 2. A shell script has to be started in the background and given this
> >> > process-id. This background process will sleep for 1 hr (Abhijit's
> >> sleep
> >> > 3600) and, on waking up, will kill the process whose process-id it
> >> knows.
> >> >
> >> > Even then, clever users may be able to get around this.
> >> >
> >> > Would others like to share their ideas too?
> >> >
> >> > - Manas Laha
> >> >
> >>
> >> Maybe one should write a small C program to do 2 and make it suid 755
> >> and call it from etc profile.  That will be beyond the users
> >> manipulation.
> >>
> >> etc profile can easily find the id using 'id -u'
> >>
> >> (A more professional design for a web kiosk operation could use a
> >> modified code of xscreensaver and call it from etc profile in the
> >> above way to lock the screen instead of logging a user out, so that
> >> you could remotely authorize and record a second hour! )
> >>
> >> Anshul
> >>
> >> --
> >> I'm too lazy to compose a creative sig, so i stole someone else's.
> >>
> >> --
> >> To unsubscribe, send mail to [EMAIL PROTECTED] with the body
> >> "unsubscribe ilug-cal" and an empty subject line.
> >> FAQ: http://www.ilug-cal.org/node.php?id=3
> >>
> >
> >
> 
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
> 
> --
> To unsubscribe, send mail to [EMAIL PROTECTED] with the body
> "unsubscribe ilug-cal" and an empty subject line.
> FAQ: http://www.ilug-cal.org/node.php?id=3
> 
> --
> To unsubscribe, send mail to [EMAIL PROTECTED] with the body
> "unsubscribe ilug-cal" and an empty subject line.
> FAQ: http://www.ilug-cal.org/node.php?id=3
> 


-- 
I'm too lazy to compose a creative sig, so i stole someone else's.

--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3


--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3

Reply via email to