Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: can't write zsh_history



On Oct 13, 2006, at 10:30 AM, William Scott wrote:



On Fri, 13 Oct 2006, William Scott wrote:

root. Is there something I can do to alter the way zsh writes to my
history file when I am root?
if (( ! EUID )); then
 HISTFILE=~/.history_root
else
 HISTFILE=~/.history
fi

You got my hopes up with this, but unfortunately I can't get this
to work, using my favorite security hole:

luser-%  sudo zsh
root-#   (various nefarious evildoing)
root-#   exit
zsh: can't write history file /Users/luser/.zsh_history

(I call it .zsh_history, BTW).

Even "sudo zsh -l" doesn't help.  $HISTFILE never changes.
I thought about having it update dynamically like $PWD,
but it seems like a lot of overhead for an occasional
irritation.  In addition, in my case at least the
ownership of ~/.zsh_history remains with luser.



I should never post before morning coffee.  sudo /bin/zsh -l
corrects the problem; I had a differently behaving zsh at
the head of the $PATH.

So a slightly different question:

is there a way to alias

"sudo zsh"  to "sudo /bin/zsh -l" ?



I'd like to mention that I decided to "su -" and not just "su"f, and this way I can use root's startup files and not have to worry about my files being touched. It works .... for now ;)

Mike



Messages sorted by: Reverse Date, Date, Thread, Author