vi run as root gives error accessing .exrc

今天有用户在使用某个内部工具时遇到这样一个问题:

 

 

Not owner of .exrc or .exrc is group or world writable
Error detected in .exrc.[Hit return to continue]

 

他说这个问题只在某些server上存在,大多数server上不会遇到。上穷碧落下黄泉地在公司内部搜索了一遍,没发现有用的信息。
郁闷中想起Google,于是试了一下,结果却是大喜过望,原来这是一个常见的vi引起的问题。
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4938594有详细的解释,转载如下:
  
  
Description
If a user has a $HOME/.exrc file, and runs vi while su'ed to root,
the error:

Not owner of .exrc or .exrc is group or world writable
Error detected in .exrc.[Hit return to continue]
Work Around
set the EXINIT environment variable.  Please search the vi man pages for "EXINIT" for infomation on this.

Here's is what I added to my .cshrc file:
setenv EXINIT 'set tabstop=4 wrapscan nomesg | map @4 :set tabstop=4^M |
map @8 :set tabstop=8^M | map @L :set list^M | map @l :set nolist^M |
map @n :w/!^M:n^M | map @N :n^M | map @r :w/!^M:rewind^M|map @R
:rewind/!^M |
map @W :w/!^M^Z | map @D Oopen(DB,">>/tmp/dbgdrc");^Mprint DB
"/n";^Mclose(DB);^['

NOTES:
1) ^M is a ctrl-M (entered as ctrl-v ctrl-m) and ^[ is an escape
character (ctrl-v Esc).
2) The '!' has to be escaped with the backslash to prevent it being
interpreted by the shell.
3) Everything between the single quotes is on a single line. It is
broken here for readability.
4) Rename/delete the .exrc file or you'll get the same error as before.

 xxxxx@xxxxx.com 2004-12-10 23:57:36 GMT
Comments
N/A

To avoid error "Not owner of .exrc or .exrc is group or world writable" in vi -- Posted by inturi on Wednesday, January 23 2008
set this environment variable
export EXINIT="set noexrc"

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值