Solved

/etc/*logout*

Posted on 2002-05-07
14
1,617 Views
Last Modified: 2013-12-26
Does anybody know of the equivalent functionality of csh's /etc/csh.logout (assuming that no user has /etc as home directory, and that no user can modify the corresponding file) for
  1) bash
  2) ksh
  3) pdksh
  4) sh

(I'll give points for each shell)
0
Comment
Question by:ahoffmann
  • 6
  • 3
  • 3
  • +1
14 Comments
 
LVL 11

Expert Comment

by:griessh
ID: 6997965
No logout for ksh (at least I have never heard of it)

bash:      ~/.bash_logout
csh/tcsh   ~/.logout

but none of them has protected logout files.

======
Werner
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 6998205
Werner, files in ~ are not protected, that's why I asked.

csh/tcsh use /etc/csh.logout, slowly I begin to understand why I use these two since roughly 20 years :-))
0
 
LVL 11

Expert Comment

by:griessh
ID: 6999351
I understood that very well when I read your question, asking myself: what does he want?

When I started digging deeper, and I recognognized that there is NO mechanism like that in ksh and what
the possibilities were if it had it, I was tempted to switch over to tcsh right away :-). I just fear,
my groups whole environment relies way too much on ksh ...

=====
Werner
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 6999477
> .. NO mechanism like that in ksh ..
which one do you mean? or did you mean csh/tcsh?

BTW, off topic here: ksh has some more dragons to beat :-o
0
 
LVL 38

Expert Comment

by:yuzh
ID: 7000561
You can force ksh to use .logout (make it behave like Csh)
by putting the following in the .profile:

trap `. ~/.logout` EXIT
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 7000625
yuzh, even if there're ksh implementation which work this way, it's a useless effort 'cause the user always can remove files in ~
Also keep in mind that ksh does not execute .profile when not a login shell (depending on implementation)

Thanks anyway, it's a nice trick will not be understood by unexperianced users :-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 38

Expert Comment

by:yuzh
ID: 7000720
ahoffmann, it is not the native ksh implementation. I've got
the "trap" come out off my head when I was writting the comment, to make it behave like csh/tcsh.

I agreed with you, when ksh is not the login shell the .profile is not read, and the user can modify it.

how about write a wrapper for ksh?

It is tough to do it with ksh.
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 7000763
yuzh, thanks for hints.
I know how to write wrappers, tweaking /etc/profile etc. so that at least for unexperianced users happens what admins want ;-)

I'm searching for a simple soltion (like /etc/csh.logout, even the trap one would be sufficient), which could be installed easily on several platforms.
Unfortunately I experianced that ksh becomes more and more a dragon :-(

I was not shure if my impression that most shells do not have a similar feature. I'm also to lazy to read through all the man-pages (which I've done to often last years), to find the sentence: not possible.

I also expect the amswer: not possible.
But seems that most people, just like me, are not 100% shure about this.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 7001314
Unfortunately, each shell has their own implementation. not all the command 100% compatible. Think abou the ulimit and limit command between ksh and csh/tcsh, the syntax different. I hope we can get around with them.

I do understand how you feel, I face the same type of problem sometime.

I hnow you can write wrappers. good luck with this one.


0
 
LVL 3

Accepted Solution

by:
elfie earned 50 total points
ID: 7010823
You could give the users a new shell which works like a wrapper.

use as shell /usr/bin/ksh.logout. This script could containd first call /usr/bin/ksh and then you could execute your 'logout script'.
Not 100% what you want, but this way users can't avoid executing the 'logout' logic.
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 7097288
I'll keep this question open for more suggestions, still hope that some more experts join ...

Anyway, think that griessh's "no logout for ksh" is the most complete answer so far.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7097354
Yep! You got me interested in that logout file ... I did some research and digging ... couldn't come upwith anything new.

======
Werner
0
 
LVL 51

Author Comment

by:ahoffmann
ID: 7319923
#! /bin/sh
/usr/bin/ksh; exec /etc/ksh.logout

# was the most sufficient solution, and it's hard to break in, and it's more robust when using a restricted shell
# BTW, this way it works for most shells too
# simple, isn't it ;-)
THANKS.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
no14 challenge 14 62
either24  challenge 19 90
firstChar challenge 13 106
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 72
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now