From 56dfd46a24028e0466a04014a449747bb1ab9cee Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 6 Jan 2010 17:33:25 +0100 Subject: [PATCH] vimrc: Don't allow running as root. --- vimrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vimrc b/vimrc index 040dad1..c8ce11f 100644 --- a/vimrc +++ b/vimrc @@ -3,6 +3,13 @@ " EDITOR SETTINGS +" Prevent editing as root as it may cause security problems. Use sudoedit +" instead. Thanks to godlygeek in #vim on Freenode (2009-06-19 22:21). +if $HOME == '/root' || exists('$SUDO_USER') + echomsg 'Running as root is forbidden! Use sudoedit.' + qa +endif + " Make sure Vim (and not Vi) settings are used. set nocompatible -- 2.45.2