zsh-users
 help / color / mirror / code / Atom feed
* RE: HOW do i..
       [not found] <Pine.BSF.4.21.0012261832580.18605-100000@tmd.df.ru>
@ 2000-12-27  7:31 ` Andrej Borsenkow
  2000-12-27 16:01   ` Vlad
  2000-12-27 22:32   ` Steve Reid
  0 siblings, 2 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2000-12-27  7:31 UTC (permalink / raw)
  To: Vlad, zsh-users

[moved to zsh-users]

>
> ..do the following:
>
> 1. i want root to be the owner of users's history file.
> 2. everytime the user exits the system, i want his history file to be
> mailed to whatever e-mail address specified. how do i execute a command
> upon exiting? i always use TRAPEXIT, however, i can't make zsh to
> read/write with root permissions.
>



I suspect, you want

- get log of all user activity
- prevent user from modifying this log

This can't be done, sorry. To save history entries in a file, this file should
be user-writable. It does not matter, whom this file belongs to. History file
is written (if at all) after every command. It means, user can edit it at any
time and remove any entries. This applies to any logging.

The most you can do is to use fc command to write *current* entries (up to
HISTSIZE) to some file at logout. But, how can you prevent user from modifying
.logout, TRAPEXIT ot whatever?

-andrej


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

* RE: HOW do i..
  2000-12-27  7:31 ` HOW do i Andrej Borsenkow
@ 2000-12-27 16:01   ` Vlad
  2000-12-27 16:08     ` Thomas Köhler
  2000-12-28 11:27     ` Andrej Borsenkow
  2000-12-27 22:32   ` Steve Reid
  1 sibling, 2 replies; 5+ messages in thread
From: Vlad @ 2000-12-27 16:01 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: zsh-users

> I suspect, you want
> 
> - get log of all user activity
> - prevent user from modifying this log
> 
> This can't be done, sorry. To save history entries in a file, this file should
> be user-writable. It does not matter, whom this file belongs to. History file
> is written (if at all) after every command. It means, user can edit it at any
> time and remove any entries. This applies to any logging.

is there a way to simultaneously log user's activity under root? 

> 
> The most you can do is to use fc command to write *current* entries (up to
> HISTSIZE) to some file at logout. But, how can you prevent user from modifying
> .logout, TRAPEXIT ot whatever?

-rw-r--r--  1 root  wheel  87 Dec 26 19:42 /etc/zshrc

> 
> -andrej
> 


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

* Re: HOW do i..
  2000-12-27 16:01   ` Vlad
@ 2000-12-27 16:08     ` Thomas Köhler
  2000-12-28 11:27     ` Andrej Borsenkow
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Köhler @ 2000-12-27 16:08 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On Wed, Dec 27, 2000 at 11:01:36AM -0500,
Vlad <tmd@tmd.df.ru> wrote:
> 
> > I suspect, you want
> > 
> > - get log of all user activity
> > - prevent user from modifying this log
> > 
> > This can't be done, sorry. To save history entries in a file, this file should
> > be user-writable. It does not matter, whom this file belongs to. History file
> > is written (if at all) after every command. It means, user can edit it at any
> > time and remove any entries. This applies to any logging.
> 
> is there a way to simultaneously log user's activity under root? 

You can always spy his tty.

There's even tools for that out there, search freshmeat and such...

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: HOW do i..
  2000-12-27  7:31 ` HOW do i Andrej Borsenkow
  2000-12-27 16:01   ` Vlad
@ 2000-12-27 22:32   ` Steve Reid
  1 sibling, 0 replies; 5+ messages in thread
From: Steve Reid @ 2000-12-27 22:32 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Vlad, zsh-users

On Wed, Dec 27, 2000 at 10:31:46AM +0300, Andrej Borsenkow wrote:
> This can't be done, sorry. To save history entries in a file, this file should
> be user-writable. It does not matter, whom this file belongs to. History file
> is written (if at all) after every command. It means, user can edit it at any
> time and remove any entries. This applies to any logging.

Some operating systems allow you to set files append-only. For example,
under FreeBSD (and I think all 4.4-derived BSDs) the command "chflags
uappnd [file]" will set a file append-only, and only the owner or
superuser can remove the flag. "chflags sappnd [file]" and only the
superuser can remove the flag, and only if kern.securelevel is less
than one. I believe Linux has similar functionality.

I don't know whether or not this will work with the history mechanism.
If it can be set to append each line one at a time without trying to
re-write the entire file then it should work.


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

* RE: HOW do i..
  2000-12-27 16:01   ` Vlad
  2000-12-27 16:08     ` Thomas Köhler
@ 2000-12-28 11:27     ` Andrej Borsenkow
  1 sibling, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2000-12-28 11:27 UTC (permalink / raw)
  To: Vlad; +Cc: zsh-users

>
> is there a way to simultaneously log user's activity under root?
>

There is no zsh-internal way that cannot be overcome by user. As suggested,
use tty spy programs. Besides, depending on options, not everything may be
saved in history (or in wrong order).

You may use preexec function to log current command, but you cannot prevent
user from un- or re-defining it. See below.

> >
> > The most you can do is to use fc command to write *current* entries (up to
> > HISTSIZE) to some file at logout. But, how can you prevent user
> from modifying
> > .logout, TRAPEXIT ot whatever?
>
> -rw-r--r--  1 root  wheel  87 Dec 26 19:42 /etc/zshrc
>

???

setopt norcs
unset TRAPEXIT

I used wrong word, sorry. I did not mean "modifying zlogout". I meant, that
user can always prevent zsh from running it, can unset/change any
variable/function.

-andrej


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

end of thread, other threads:[~2000-12-28 11:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.BSF.4.21.0012261832580.18605-100000@tmd.df.ru>
2000-12-27  7:31 ` HOW do i Andrej Borsenkow
2000-12-27 16:01   ` Vlad
2000-12-27 16:08     ` Thomas Köhler
2000-12-28 11:27     ` Andrej Borsenkow
2000-12-27 22:32   ` Steve Reid

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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