LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   editor for visudo (https://www.linuxquestions.org/questions/linux-newbie-8/editor-for-visudo-773137/)

newk 12-03-2009 02:53 AM

editor for visudo
 
Ubuntu 9.04

I have a sudoer user

I've tried to add export VISUAL=vi (also I tried to add EDITOR=vi; export EDITOR) to .profile , .bash_profile, .bashrc of that sudoer user. But nano is still a default editor. Only when I add export VISUAL=vi to /etc/profile the default editor becomes VI (but only for ROOT user). I'm trying all this under true console and after editing profiles I relogin. Where am I wrong please?

Tinkster 12-03-2009 02:59 AM

How are you invoking visudo?

newk 12-03-2009 03:02 AM

sudo visudo

EricTRA 12-03-2009 03:08 AM

Hello,

visudo looks at /usr/bin/editor for which editor is to be used. You can change it using:
Code:

update-alternatives --config editor
which will show you a list to choose from like below:
Code:


There are 3 alternatives which provide `editor'.

  Selection    Alternative
-----------------------------------------------
          1    /bin/ed
*+        2    /bin/nano
          3    /usr/bin/vim.tiny

Press enter to keep the default[*], or type selection number:

Take your pick and press enter. Beware that all commands that use the editor will have the new editor opening. For example, crontab also uses the editor reference.

Sorry, forgot to mention: on Ubuntu when not root use sudo.

Kind regards,

Eric

evo2 12-03-2009 03:11 AM

I guess it is because when you invoke sudo your env variables are not carried over.

... quick "man sudo"...

What if you invoke it as
Code:

sudo -E visudo
Evo2.

newk 12-03-2009 03:24 AM

sudo -E visudo

works great.

It's the first time (amongst many books and howtos) when I hear about -E option. Now I doubt what to learn - mans or books? Ofcourse I understand that all people here will say MANs...

Thanks you all for your replies.

chrism01 12-03-2009 06:20 PM

For details like that, man pages, otherwise you'd have to buy a lot(!) of books.
I find this one is easy to use/read http://linux.die.net/man/
Here's a long list of online free to read books http://www.linuxtopia.org/online_books/index.html
Enjoy :)

newk 12-04-2009 01:01 AM

Thank you chrism01 for the links!


All times are GMT -5. The time now is 04:25 AM.