You are not logged in.

#1 2006-11-24 09:41:02

cyberpatrol
Member
From: Germany
Registered: 2006-11-22
Posts: 68

visudo with nano?

Hi!

I'm currently giving Arch Linux a trial switching from Gentoo to it in mind. My first and second impression is that Arch Linux is a pretty good distribution and I already like it.

Nevertheless I have one problem with visudo.

On Gentoo it's possible to get visudo working with any other editor than vim, e.g. with nano. Only the environment variable EDITOR has to be set to "/usr/bin/nano".

On Arch Linux I installed sudo by running "pacman -S sudo" and also set the environment variable EDITOR to "/usr/bin/nano" but I'm getting this error message when starting visudo: "visudo: no editor found (editor path = /usr/bin/vi)"

So my question is: Is it on Arch Linux also possible to get visudo working with nano instead of vim and what do I need to do? Or am I forced to install vim to get visudo working?

Offline

#2 2006-11-24 09:53:42

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: visudo with nano?

It's possible, of course. man visudo, specifically the 2nd paragraph, explains it all.

Please note the security implications of rebuilding sudo to support the EDITOR environment variable.

Offline

#3 2006-11-24 14:50:52

cyberpatrol
Member
From: Germany
Registered: 2006-11-22
Posts: 68

Re: visudo with nano?

Thanks for your answer.

I'd of course read the man page but the only thing I understood is that there is a configure flag and that I had to recompile sudo to toggle it what I wanted to avoid. If I hadn't missed `man sudoers` I'd understood the whole paragraph especially the meaning and usage of the variables and flags which can be set in sudoers.  :oops:

Actually these are the lines I added to sudoers:

# Defaults specification

# Reset environment by default
Defaults      env_reset

# Set default EDITOR to nano, and do not allow visudo to use EDITOR/VISUAL.
Defaults      editor=/usr/bin/nano, !env_editor

I guess with these settings the security hole should be closed because sudoers can only be read and written by root.

Recompiling sudo isn't necessary with these sudoers settings. These changes can be made with nano itself without using visudo. Any other change should of course be made with visudo.

Offline

#4 2006-11-27 06:33:51

mpie
Member
From: 404 Not found
Registered: 2005-03-06
Posts: 649

Re: visudo with nano?

just open it with nano as root.....
it works

Offline

#5 2006-11-27 21:42:06

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: visudo with nano?

mpie wrote:

just open it with nano as root.....
it works

You can do that, but it's not the best idea since visudo automatically checks syntax upon exit and will prompt you if something is wrong.  That way, it makes accidentally disabling sudo a lot more difficult.  Check out <code>man visudo</code> for more details.

Offline

#6 2006-12-02 06:59:08

cyberpatrol
Member
From: Germany
Registered: 2006-11-22
Posts: 68

Re: visudo with nano?

Of course it's not the best idea to edit sudoers directly without visudo but if one doesn't have vim installed and doesn't want to install it in favour of nano this is the only possibility to change the editor. And if you know that there's definitely no other user who could want to change sudoers at the same time and if you don't change anything else except the editor settings in sudoers then it shouldn't be a problem to edit sudoers directly without visudo.

Anything else, of course, should be done with visudo.

Offline

#7 2006-12-02 14:00:31

McQueen
Member
From: Arizona
Registered: 2006-03-20
Posts: 382

Re: visudo with nano?

cyberpatrol wrote:

Of course it's not the best idea to edit sudoers directly without visudo but if one doesn't have vim installed and doesn't want to install it in favour of nano this is the only possibility to change the editor.

Just changing the symlink of the vi executable to nano will system default to nano.


/path/to/Truth

Offline

#8 2006-12-02 19:24:53

cyberpatrol
Member
From: Germany
Registered: 2006-11-22
Posts: 68

Re: visudo with nano?

That's probably the best idea. I don't know why I didn't think of that.
Thank you for the hint, McQueen.

Offline

Board footer

Powered by FluxBB