LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sudo crontab -e ... how to change to "vi" editor ? (http://www.linuxquestions.org/questions/linux-newbie-8/sudo-crontab-e-how-to-change-to-vi-editor-4175435541/)

masuch 11-04-2012 04:07 AM

sudo crontab -e ... how to change to "vi" editor ?
 
Hi,

I have in /root/.bashrc settings:
export VISUAL="/usr/bin/vi"
export EDITOR="/usr/bin/vi -e"

if I type in root shell:
crontab -e -- it is vi.
in user:
sudo crontab -e -- it is nano editor ???

Can pleaase anybody to help me what else should I setup to have vi editor for "sudo crontab -e" ?

thank you,
kind reagrds,
M.

AwesomeMachine 11-04-2012 04:12 AM

Try editing .bashrc in your home directory. Otherwise, sometimes there is a soft link: /usr/bin/editor, linked to /usr/bin/vim or /usr/bin/nano. Try

# ls -l /usr/bin/editor

I hope this helps.

masuch 11-04-2012 04:22 AM

Quote:

Originally Posted by AwesomeMachine (Post 4821811)
Try editing .bashrc in your home directory. Otherwise, sometimes there is a soft link: /usr/bin/editor, linked to /usr/bin/vim or /usr/bin/nano. Try

# ls -l /usr/bin/editor

I hope this helps.

I have/had EDITOR/VISUAL properly configured.

I have
ls -lA /etc/alternatives/editor
lrwxrwxrwx 1 root root 18 Oct 14 19:33 /etc/alternatives/editor -> /usr/bin/vim.gnome

linosaurusroot 11-04-2012 05:15 AM

Look in your sudoers file. There may be a definition "Defaults env_keep" that does not include EDITOR. I wouldn't allow a "crontab -e" in a sudoers anyway - might as well give them a shell.

masuch 11-04-2012 06:56 AM

Quote:

Originally Posted by linosaurusroot (Post 4821836)
Look in your sudoers file. There may be a definition "Defaults env_keep" that does not include EDITOR. I wouldn't allow a "crontab -e" in a sudoers anyway - might as well give them a shell.

thanks a lot ,
Quote:

Defaults env_keep=EDITOR
works just fine.
I have read that
Quote:

Defaults:user env_keep=EDITOR
could be working for that specific "user" , right ?

And where is specified that nano has to be used by default ?
In sudoers is no info about nano as an default editor and my env variables did not contain it either anywhere.


All times are GMT -5. The time now is 02:06 AM.