Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The .viminfo file in my home directory is owned by root. Could anyone please explain how that could have happened without me asking it?

$ ls -la | grep .viminfo
-rw-------  1 root    root       4175 Nov  3 19:11 .viminfo
share|improve this question

2 Answers 2

up vote 2 down vote accepted

I think it was created while using "sudo vim" to edit some file on the system.

share|improve this answer
    
sudo -s or -u retain the shell environment, i.e. the users home directory when using sudo thus vim thinks it is supposed to be so. –  con-f-use Nov 3 '12 at 12:54
    
After digging a bit I found that .viminfo is created when you run vim for the first time. I ran 'sudo vim' to edit /etc/apt/sources.list file. Since 'sudo' keeps $HOME variable, .viminfo was created in my home directory with root as the owner. –  Tarique Nov 3 '12 at 14:16

This could happen if you run vim after sudo -s

You can chown it back to your id:group anyway, does't hurt;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.