DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 12th December 2010
yurtesen yurtesen is offline
Port Guard
 
Join Date: May 2008
Posts: 18
Thanked 1 Time in 1 Post
Default csh/history/su problem

Hello,

I have a problem where the history is not written to disk.

For example, user A logs into the machine and uses 'su -' to become root, if A does not logout properly but just closes his ssh client, the history is not saved. If A logs out from the machine properly, then closes the ssh client then the history is saved.

Perhaps the shell could be killed when user closes the ssh client and it is not able to write history?

Does anybody have a workaround?

Thanks,
Evren
Reply With Quote
  #2   (View Single Post)  
Old 12th December 2010
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,074
Thanked 198 Times in 156 Posts
Default

What's your savehist setting in in the tcsh start file?
I've been using:
Code:
set savehist = 4096 merge
For ages, and never noticed any "amnesia" from my shell, but as I understand tcsh(1), $ history -S is run "when exiting the shell". I'm not sure if losing a ssh connection is handled as a "proper" exit.

You can try adding $ history -S to /etc/csh.logout, and you can of course also run it manually to save the history ...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 12th December 2010
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,074
Thanked 198 Times in 156 Posts
Default

Update:
I just tested this, I connected with putty, closed the session by going to the task manager and killing putty, and when I logged back on, the history was saved.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #4   (View Single Post)  
Old 12th December 2010
yurtesen yurtesen is offline
Port Guard
 
Join Date: May 2008
Posts: 18
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Carpetsmoker View Post
Update:
I just tested this, I connected with putty, closed the session by going to the task manager and killing putty, and when I logged back on, the history was saved.
It seems to work here as well if I login as a normal user then close the putty using the X in the corner.

However if I login as a normal user and then do a 'su -' and then close using X in the corner, the normal user seems to have his history saved but nothing he did when he was root was saved in root's history.

If I logout from being root before closing with X, then root gets the .history file updated.

I have the savehist set properly I believe and the csh manual says that this implies 'history -S' ... so that shouldnt be a problem either?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD the history of /usr ocicat News 2 27th August 2010 06:55 PM
Firefox history J65nko News 0 4th May 2010 10:40 PM
ksh history and rm * JMJ_coder General software and network 0 20th January 2010 10:08 PM
weird history problem mmusang FreeBSD General 2 17th May 2008 07:07 PM


All times are GMT. The time now is 03:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick