LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   visudo and pico (https://www.linuxquestions.org/questions/slackware-14/visudo-and-pico-302006/)

crud 03-15-2005 03:34 PM

visudo and pico
 
Hi there,
I put that on my /root/.bashrc and /home/crud/.bashrc:

EDITOR=pico; export EDITOR
VISUAL=pico; export VISUAL

I do 'source /root/.bashrc', I run 'visudo', and it opens with vi :( How can I do to make it open with pico ?

Greets,

C-

david_ross 03-15-2005 03:51 PM

From the man page:
Quote:

Normally, visudo does not honor the VISUAL or EDITOR environment variables unless they contain an editor in the aforementioned editors list. However, if visudo is configured with the --with-enveditor flag or the enveditor Default variable is set in sudoers, visudo will use any the editor defines by VISUAL or EDITOR. Note that this can be a security hole since it allows the user to execute any program they wish simply by setting VISUAL or EDITOR.

heema 03-16-2005 04:20 AM

you could also do

pico /etc/sudoers

perfect_circle 03-16-2005 04:51 AM

"However, if visudo is configured with the --with-enveditor flag or the enveditor Default variable is set in sudoers"

this is from sudo's slackbuild:
Code:

FLAGS="$SLKCFLAGS" \
./configure --prefix=/usr --sbindir=/usr/sbin --with-getpass --with-C2
make

I don't think that sudo is compiled with --with-enveditor, if that is what the manpage is saying.

Anyway it would have a security hole. In linux there is no vi any more. We use vi-clones. In most distros vi is just a link to vim. In slackaware it's a link to elvis.
Code:

bash-3.00$ ls -l /usr/bin/vi
lrwxrwxrwx  1 root root 5 2005-03-16 12:34 /usr/bin/vi -> elvis
bash-3.00$

If you remove that link and link vi to pico, then visudo will open /etc/sudoers with pico:
Code:

cd /usr/bin
rm vi
ln -s pico vi

If you use pico as your default editor you may keep the link, but I would recommend you to learn vi. It's a really powerful editor

*EDIT*
As far as i know slackware do not make use of .bashrc . What ever enviromental variables you want to add/edit, put them in .profile


All times are GMT -5. The time now is 10:37 PM.