On Fri, May 21, 2010 at 6:50 AM, ItayP <[email protected]> wrote: > Since by default sudo leaves $HOME unchanged, running 'sudo vim' when > the user does not have a ~/.viminfo file (e.g. first run), will cause > the file to be created in the user's home directory (not in /root), > but owned by root with mode 600 so it is not usable when vim is later > run as a normal user.
This is one reason, among many, that I typically suggest people use "sudoedit"/"sudo -e". There are few reasons to run an editor as root if you're already using sudo. > A possible fix would be to use getpwuid(3) to retrieve the home > directory, which should be more reliable than $HOME. That's a workaround, not a fix. Any program which is run via sudo, without passing the -i flag, is going to have $HOME set to the calling user's homedir instead of that of the user they're sudoing to. The proper fix is to educate users to understand this since it affects more than just Vim. -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]> -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
