[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I'am root user, but 'emacs /etc/sudoers' still report Buffer is read

From: Bob Proulx
Subject: Re: I'am root user, but 'emacs /etc/sudoers' still report Buffer is read-only: #<buffer sudoers> in modeline
Date: Thu, 30 Apr 2015 15:36:23 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Emanuel Berg wrote:
> Indeed, however because you must run Emacs with
> superuser rights in order to edit /etc/sudoers (I.e.
> you won't get your everyday user's Emacs configs)

That depends upon how you invoked sudo and emacs.  Normally you will
have your non-root emacs configuration.

  $ sudo printenv HOME USER

When running commands such as 'sudo emacs' the process id is changed,
and USER=root, but the HOME variable is not changed.  However that is
configurable.  It is possible your system has been configured
otherwise.  But that would be the normal default for most people.

> it can be preferable to use something altogether
> different and above all more simple, like nano, which
> seems to be the default -

Because both emacs and vim (the two most popular technical editors)
need some knowledge and learning in order to use them distributions
often include nano as a simple editor that can be used without any
pre-existing knowledge.  Nano includes an on screen menu so that you
need learn nothing ahead of the time of using it.  And there are few
features beyond what is available on the menu.

> in spite of the name (or perhaps "vi"sudo refers to "visual" and not
> vi(m)).

It really meant vi.  The 'visudo' name follows 'vipw' program (and
'vigr') which originally would spawn vi on the password file.  Or any
other program as specified in the EDITOR field.  But they fell back to
using vi if EDITOR was not set.  Now in the modern age things are more
configurable for different user preferences such as editor.

It was long very popular to use use the language "vi a file" as a
generic in the same way that people might say Kleenex or Escalator or
Xerox even though those are all company tradmarks and should not be
used generically.

And so we have vipw and visudo which both would have originally
spawned vi on the respective files.  But now the vi part of the name
of those classic tools is used generically to mean edit the file.
Anything else would require changing the name and that would be
egregiously breaking scripts and things that used the previous name.

> If you are dead set on using Emacs, try
>     sudo EDITOR='/usr/bin/emacs -u USER' visudo

Not necessary when using the typical sudo configuration.  Really!  :-)
What does this say for you?

  $ sudo printenv HOME


reply via email to

[Prev in Thread] Current Thread [Next in Thread]