linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Starting "Script" when user logs on.
@ 2005-08-03 10:38 Md Shanto
  2005-08-03 12:48 ` urgrue
  2005-08-04 11:11 ` Glynn Clements
  0 siblings, 2 replies; 6+ messages in thread
From: Md Shanto @ 2005-08-03 10:38 UTC (permalink / raw)
  To: linux-admin

Hi all,

I am trying to force "script" for logging all text I/O activities at
the moment user logs in. Most of the users are running bash at this
moment.

Initially I tired with "ttyrec" a tty recorder and failed, as it says
"Out of pty's - Terminated". Now, I tried something like below:

------------------
#!/bin/bash -l
USER=`whoami`
LOGTIME=`date +%Y-%m-%d-%H:%M:%S`
/usr/bin/script -q /var/log/commlog/$USER-$LOGTIME
------------------

and assigning this script in /etc/passws. This script will log scripts
with time stamp in /var/log/commlog/.

what happen is: when user logs in the process becomes a loop and I see
lot of script instances are running.

Any idea.

-Refayet

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Starting "Script" when user logs on.
  2005-08-03 10:38 Starting "Script" when user logs on Md Shanto
@ 2005-08-03 12:48 ` urgrue
  2005-08-03 13:01   ` Andy Davidson
  2005-08-04 19:06   ` GH Snijders
  2005-08-04 11:11 ` Glynn Clements
  1 sibling, 2 replies; 6+ messages in thread
From: urgrue @ 2005-08-03 12:48 UTC (permalink / raw)
  To: Md Shanto; +Cc: linux-admin

I don't think script will help you, as even if you get it working, your  
users can just Ctrl-D out of it. Unless you trust your users.
Once upon a time I used ttysnoop:
http://freshmeat.net/projects/ttysnoop/


On 08/03/2005 01:38:10 PM, Md Shanto wrote:
> Hi all,
> 
> I am trying to force "script" for logging all text I/O activities at
> the moment user logs in. Most of the users are running bash at this
> moment.
> 
> Initially I tired with "ttyrec" a tty recorder and failed, as it says
> "Out of pty's - Terminated". Now, I tried something like below:
> 
> ------------------
> #!/bin/bash -l
> USER=`whoami`
> LOGTIME=`date +%Y-%m-%d-%H:%M:%S`
> /usr/bin/script -q /var/log/commlog/$USER-$LOGTIME
> ------------------
> 
> and assigning this script in /etc/passws. This script will log
> scripts
> with time stamp in /var/log/commlog/.
> 
> what happen is: when user logs in the process becomes a loop and I
> see
> lot of script instances are running.
> 
> Any idea.
> 
> -Refayet
> -
> To unsubscribe from this list: send the line "unsubscribe linux- 
> admin"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Starting "Script" when user logs on.
  2005-08-03 12:48 ` urgrue
@ 2005-08-03 13:01   ` Andy Davidson
  2005-08-03 17:20     ` Jason Clark
  2005-08-04 19:06   ` GH Snijders
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Davidson @ 2005-08-03 13:01 UTC (permalink / raw)
  To: linux-admin

urgrue wrote:
> I don't think script will help you, as even if you get it working, your  
> users can just Ctrl-D out of it. Unless you trust your users.

Unless you can get this script running as some kind of wrapper to bash. 
  Then you can change the default shell for your users to point at this 
wrapper ..

-a
-- 
Regards, Andy Davidson
http://www.fotoserve.com/ - Great deals on digital imaging output.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Starting "Script" when user logs on.
  2005-08-03 13:01   ` Andy Davidson
@ 2005-08-03 17:20     ` Jason Clark
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Clark @ 2005-08-03 17:20 UTC (permalink / raw)
  To: Andy Davidson; +Cc: linux-admin

use screen to start their shell and turn on logging in screen.

-- 

Jason
The place where you made your stand never mattered. Only that you were there..
And still on your feet.

On Wed, 3 Aug 2005, Andy Davidson wrote:

> urgrue wrote:
>>   I don't think script will help you, as even if you get it working, your 
>>   users can just Ctrl-D out of it. Unless you trust your users.
>
> Unless you can get this script running as some kind of wrapper to bash.  Then 
> you can change the default shell for your users to point at this wrapper ..
>
> -a
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Starting "Script" when user logs on.
  2005-08-03 10:38 Starting "Script" when user logs on Md Shanto
  2005-08-03 12:48 ` urgrue
@ 2005-08-04 11:11 ` Glynn Clements
  1 sibling, 0 replies; 6+ messages in thread
From: Glynn Clements @ 2005-08-04 11:11 UTC (permalink / raw)
  To: Md Shanto; +Cc: linux-admin


Md Shanto wrote:

> Initially I tired with "ttyrec" a tty recorder and failed, as it says
> "Out of pty's - Terminated".

Unless these processes aren't being cleaned up (in which case, you
will probably have over a hundred stale ttyrec processes), it may be
that ttyrec was compiled for BSD-style ptys but your system is using
Unix98 ptys (or vice-versa).

> Now, I tried something like below:
> 
> ------------------
> #!/bin/bash -l
> USER=`whoami`
> LOGTIME=`date +%Y-%m-%d-%H:%M:%S`
> /usr/bin/script -q /var/log/commlog/$USER-$LOGTIME
> ------------------

Apart from anything else, you should probably use "exec" for the last
statement, i.e.:

	exec /usr/bin/script -q /var/log/commlog/$USER-$LOGTIME

This causes the "script" process to replace the bash process running
the shell script, rather than leaving the bash process hanging around
until script exits.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Starting "Script" when user logs on.
  2005-08-03 12:48 ` urgrue
  2005-08-03 13:01   ` Andy Davidson
@ 2005-08-04 19:06   ` GH Snijders
  1 sibling, 0 replies; 6+ messages in thread
From: GH Snijders @ 2005-08-04 19:06 UTC (permalink / raw)
  To: linux-admin

urgrue <urgrue <at> tumsan.fi> writes:

> 
> I don't think script will help you, as even if you get it working, your  
> users can just Ctrl-D out of it. Unless you trust your users.
> Once upon a time I used ttysnoop:
> http://freshmeat.net/projects/ttysnoop/
> 
> On 08/03/2005 01:38:10 PM, Md Shanto wrote:
> > Hi all,
> > 
> > I am trying to force "script" for logging all text I/O activities at
> > the moment user logs in. Most of the users are running bash at this
> > moment.
> > 
> > Initially I tired with "ttyrec" a tty recorder and failed, as it says
> > "Out of pty's - Terminated". Now, I tried something like below:

[...]

> > and assigning this script in /etc/passws. This script will log
> > scripts
> > with time stamp in /var/log/commlog/.
> > 
> > what happen is: when user logs in the process becomes a loop and I
> > see lot of script instances are running.

I think (not sure) that script also tries to start the default shell for the
user and calling the script in the process...

Perhaps you could try a line like:
/path/to/script ; exit
at the end of your /etc/profile?


Not sure if it'll work, though.


HTH, HAND

mvg,
   Guus



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-04 19:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-03 10:38 Starting "Script" when user logs on Md Shanto
2005-08-03 12:48 ` urgrue
2005-08-03 13:01   ` Andy Davidson
2005-08-03 17:20     ` Jason Clark
2005-08-04 19:06   ` GH Snijders
2005-08-04 11:11 ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).