![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Ubuntu 9.10 is out!!!
When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu. The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely. |
|
General Help All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
A Carafe of Ubuntu
![]() Join Date: May 2008
Beans: 83
|
export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
I need to edit my sudoers file but for some reason the sudoers file keeps opening in the terminal window instead of gedit. What am I doing wrong? I'm currently running Ubuntu 8.04.
export EDITOR=gedit && sudo visudo At the moment the only way I can edit the file is to chmod it and then double click on the file icon. I can't even open gedit from the terminal as root. The following error is displayed when I type /usr/bin/gedit or gedit as root. cannot open display: Run '/usr/bin/gedit --help' to see a full list of available command line options |
|
|
|
|
|
#2 |
|
A Carafe of Ubuntu
![]() Join Date: May 2008
Beans: 83
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
Any suggestions would be appreciated.
|
|
|
|
|
|
#3 |
|
Iced Blended Vanilla Crème Ubuntu
![]() |
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
When you set an environment variable, it is set only for the particular user, not for sudo (root).
Try code: Code:
export EDITOR=gedit && sudo -E visudo Alternatively, you can change the value of "editor" in the sudoers file.
__________________
Cheers,PRShah Ubuntu, Kubuntu, Xubuntu, Mythbuntu All-in-One Live DVD "I never make mistakes; I thought I did, once.. but I was wrong." |
|
|
|
|
|
#4 |
|
Quad Shot of Ubuntu
![]() Join Date: Apr 2006
Beans: 496
Ubuntu 8.04 Hardy Heron
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
From man sudoers:
Code:
The sudoers file should always be edited by the visudo command which locks the file and does grammatical checking. It is imperative that sudoers be free of syntax errors since sudo will not run with a syntactically incorrect sudoers file. |
|
|
|
|
|
#5 |
|
A Carafe of Ubuntu
![]() Join Date: May 2008
Beans: 83
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
Thanks prshah. The -E fixed it. My only other question is how I can get gedit to open from the terminal as root. If I type su - , enter the root password, and then type gedit I'm still presented with an error stating that gedit can't open. However if I type gedit in the terminal from my standard user account it opens without any problems. Is there a line I can add to the sudoers file to fix this?
|
|
|
|
|
|
#6 |
|
Should have gone to University
![]() Join Date: Jan 2008
Location: UK
My beans are hidden!
Ubuntu 9.04 Jaunty Jackalope
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
[EDIT]
Sorry, you mean to open visudo with gedit automatically? you can add some lines to the bottom of your .bashrc file to do that. Code:
gedit ~/.bashrc PHP Code:
All you now have to type in is: Code:
sudo visudo Regards Iain
__________________
![]() Last edited by tinivole; May 3rd, 2008 at 03:08 PM.. |
|
|
|
|
|
#7 |
|
A Carafe of Ubuntu
![]() Join Date: May 2008
Beans: 83
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
Perfect! I can now open gedit from the terminal as root using sudo -s. However I'm not prompted to enter a password when I use sudo -s. I'm only prompted to enter the root password with su -.
|
|
|
|
|
|
#8 | |
|
Should have gone to University
![]() Join Date: Jan 2008
Location: UK
My beans are hidden!
Ubuntu 9.04 Jaunty Jackalope
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
Quote:
To change this (ie: to be prompted for a password everytime): open up visudo. Then type in: Code:
Defaults:ALL timestamp_timeout=0 Or if every time you use sudo is a bit excessive (ie: "sudo apt-get update && sudo apt-get upgrade && sudo apt-get clean" asks you three times in one sitting.) You can change the timeout=0 to timeout=1 or 2. The value stands for the number of minutes before it asks you again. I think the default is 15 minutes, or until the shell is closed. Regards Iain
__________________
![]() Last edited by tinivole; May 3rd, 2008 at 03:19 PM.. |
|
|
|
|
|
|
#9 |
|
A Carafe of Ubuntu
![]() Join Date: May 2008
Beans: 83
|
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
Many thanks. That fixed it and I'm now prompted for the password each time.
|
|
|
|
|
|
#10 |
|
Midnight Commander
![]() |
Re: export EDITOR=gedit && sudo visudo opens the sudoers file in the terminal window
Thanks for this, prshah. The need to use environment preservation with sudo is apparently need to Ubuntu 8.04. I'll try to incorporate this into a more permanently visible location, since there are dozens of tutorials on the web that explain how to export editors, but none that I have seen mention this.
__________________
I am aware of all internet traditions. | Getting the best help | Text formatting codes | My last.fm profile Should I PM support questions? NO! |
|
|
|
| Bookmarks |
| Tags |
| sudoers |
| Thread Tools | |
| Display Modes | |
|
|