new sudo and VIM problem

[SECURITY] [DSA 946-1] New sudo packages fix privilege escalation

I got this security update with aptitude on my own Debian GNU/Linux server and now when I use VIM with sudo (I think) sudo no longer passes the $HOME variable over to VIM, and VIM looks for $HOME/.viminfo by default. I guess $HOME is set to NULL inside sudo, so whenever I exit VIM it bitches about not being able to write to my viminfo file. (for more info about viminfo errors go here and search for the string viminfo-errors)

To fix this I have to do `sudo vi -i ~/.viminfo`, or `sudo -H vim`… for now I will alias “sudo” to “sudo -H”…

Update: after looking at the manpages more, if I set the “always_set_home” flag in my sudoers it will imply “-H” all the time, very nice.

Technorati Tags: ,

2 Responses to new sudo and VIM problem

  1. Wouter Roosendaal March 5, 2006 at 3:20 am #

    Thanx, I had this ‘problem’ also and found out that this was the solution. It is one of those non urgent annoyances that you tend to ignore since it does no harm and costs only one keystroke extra when closing a file after a ‘sudo vim blah’
    Maybe for completeness you should also add that you can set the always_set_home setting in /etc/sudoers by adding the line
    Defaults always_set_home
    somewhere at the beginning of your file, before the user definitions begin.

  2. ayn March 5, 2006 at 9:59 am #

    yup, I added that a while back after I found out about the flag in sudoers myself. in that “update:” bit at the end of my entry…

Leave a Reply