Starting "Script" when user logs on.

Starting "Script" when user logs on.

am 03.08.2005 12:38:10 von Md Shanto

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

Re: Starting "Script" when user logs on.

am 03.08.2005 14:48:01 von urgrue

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
>
>


-
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

Re: Starting "Script" when user logs on.

am 03.08.2005 15:01:30 von Andy Davidson

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.
-
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

Re: Starting "Script" when user logs on.

am 03.08.2005 19:20:20 von Jason Clark

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
>
-
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

Re: Starting "Script" when user logs on.

am 04.08.2005 13:11:56 von Glynn Clements

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.

-
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

Re: Starting "Script" when user logs on.

am 04.08.2005 21:06:04 von GH Snijders

urgrue 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


-
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