LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-03-2009, 02:53 AM   #1
newk
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Rep: Reputation: 0
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?
 
Old 12-03-2009, 02:59 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
How are you invoking visudo?
 
Old 12-03-2009, 03:02 AM   #3
newk
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
sudo visudo
 
Old 12-03-2009, 03:08 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
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

Last edited by EricTRA; 12-03-2009 at 03:09 AM. Reason: Ubuntu = use sudo
 
Old 12-03-2009, 03:11 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
Old 12-03-2009, 03:24 AM   #6
newk
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
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.
 
Old 12-03-2009, 06:20 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,389

Rep: Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774
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
 
1 members found this post helpful.
Old 12-04-2009, 01:01 AM   #8
newk
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Thank you chrism01 for the links!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
visudo in ubuntu coot Ubuntu 3 07-14-2009 10:56 AM
visudo noonmid27 Linux - Newbie 8 02-23-2007 04:42 PM
visudo and pico crud Slackware 3 03-16-2005 04:51 AM
Need help with visudo powadha Debian 2 12-19-2004 05:04 AM
visudo xviddivxoggmp3 Slackware 7 08-17-2004 08:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration