LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 11-04-2012, 04:07 AM   #1
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Rep: Reputation: 1
Question 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.
 
Old 11-04-2012, 04:12 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
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.
 
Old 11-04-2012, 04:22 AM   #3
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by AwesomeMachine View Post
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

Last edited by masuch; 11-04-2012 at 06:58 AM.
 
Old 11-04-2012, 05:15 AM   #4
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
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.
 
Old 11-04-2012, 06:56 AM   #5
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by linosaurusroot View Post
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.
 
  


Reply

Tags
crontab, editor, sudo, vi



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
[SOLVED] When I type "sudo grub" it says "command not found" in Ubuntu 9.10 Live CD. msbstar Linux - Newbie 10 04-01-2020 11:54 PM
"HOWTO Change Colour of Comments in VIM editor" manikantha Linux - General 8 07-16-2013 03:36 AM
When I type "sudo grub" it says "command not found" in Ubuntu 10.10 poumtatalia Linux - Newbie 5 09-14-2010 05:21 PM
cannot "sudo apt-get uptate" or "sudo" anything! plz help mdguy21061 Linux - Newbie 7 04-13-2008 11:59 PM
Linux Partition Table Editor - Need to change "Hidden Sectors" value Ouch_Taser Linux - Newbie 3 02-11-2004 10:03 AM

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

All times are GMT -5. The time now is 08:31 AM.

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