View previous topic :: View next topic |
Author |
Message |
Thiemo Tux's lil' helper
Joined: 20 Nov 2002 Posts: 138
|
Posted: Tue Feb 02, 2010 7:49 am Post subject: Way to automagically log a session when logging in? |
|
|
Hi all,
is there a way to log everything a user does after he has logged in automagically? I think of something like 'script session_$(date +'%Y%m%dT%H%m%S').log', however I am not sure whether this can be used as 'login shell'.
Cheers
Thiemo _________________ root ist die wurzel allen uebels |
|
Back to top |
|
|
geki Advocate
Joined: 13 May 2004 Posts: 2387 Location: Germania
|
Posted: Tue Feb 02, 2010 9:12 am Post subject: |
|
|
I would try a shell wrapper for 'script session_$(date +'%Y%m%dT%H%m%S').log' like
Quote: | #!/bin/bash
# log shell session
script session_$(date +'%Y%m%dT%H%m%S').log | or the alternative of a C wrapper. _________________ hear hear |
|
Back to top |
|
|
Thiemo Tux's lil' helper
Joined: 20 Nov 2002 Posts: 138
|
Posted: Tue Feb 02, 2010 10:56 am Post subject: |
|
|
And then put the wrapper as login shell in /etc/passwd? Might work, but it looks quite aweful to me. I mean, is this not a feature the big players like AIX, Solaris should have standardized for there high profile production system...
I just forgot to see whether bash or zsh can do the logging right away (not only the history stuff)!
geki wrote: | I would try a shell wrapper for 'script session_$(date +'%Y%m%dT%H%m%S').log' like
Quote: | #!/bin/bash
# log shell session
script session_$(date +'%Y%m%dT%H%m%S').log | or the alternative of a C wrapper. |
_________________ root ist die wurzel allen uebels |
|
Back to top |
|
|
Thiemo Tux's lil' helper
Joined: 20 Nov 2002 Posts: 138
|
Posted: Wed Feb 03, 2010 8:59 am Post subject: |
|
|
I put a call of script into .zshrc checking if the log file variable at the beginning was already set and if not, setting it. This prevents inifinite recursion.
Caveat of this solution is that sftp sessions do not get logged.
Thiemo wrote: | And then put the wrapper as login shell in /etc/passwd? Might work, but it looks quite aweful to me. I mean, is this not a feature the big players like AIX, Solaris should have standardized for there high profile production system...
I just forgot to see whether bash or zsh can do the logging right away (not only the history stuff)!
geki wrote: | I would try a shell wrapper for 'script session_$(date +'%Y%m%dT%H%m%S').log' like
Quote: | #!/bin/bash
# log shell session
script session_$(date +'%Y%m%dT%H%m%S').log | or the alternative of a C wrapper. |
|
_________________ root ist die wurzel allen uebels |
|
Back to top |
|
|
|