RHEL 5.10
When I do visudo
I get this error:
chuck 75->visudo
visudo: /etc/sudoers: Permission denied
visudo: /etc/sudoers: Permission denied
Listing of sudo exe file and /etc/sudoers:
chuck 76->ls -l /etc/sudo*
-r--r----- 1 root root 3540 May 9 11:44 /etc/sudoers
-r--r----- 1 root root 3401 Aug 12 2014 /etc/sudoers.20140812
chuck 273->ls -l `which sudo`
-rwsr-xr-x 2 root root 182040 Mar 4 2014 /usr/bin/sudo
chuck 275->ls -l `which visudo`
-rwxr-xr-x 1 root root 98576 Mar 4 2014 /usr/sbin/visudo
As you can see my /etc/sudoers.20140812 backup file has the same permissions as the actual /etc/sudoers file. So I don't know what's up.
- Just before this happened I changed my environment var in my .cshrc VISUAL to:
setenv VISUAL /usr/bin/nano
. - I've tried in the shell
unset VISUAL
but I still get "permission denied" error. - I've tried in the shell
setenv VISUAL
but that didn't work. When I didvisudo
I still get "permission denied on /etc/sudoers". - I also logged that shell window off and logged into a new one and still get "permission denied" when I do
visudo
. - I tried googling the answer and tried a few things but that didn't work.
- Searching stackexchange didn't show any past questions either.
TRIED: Another thing I tried and the error message.
chuck 59->sudo chmod 0440 /etc/sudoers
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
TRIED: Making an alias I called editsudo
: alias editsudo 'sudo chmod 770 /etc/sudoers; sudo nedit /etc/sudoers; sudo chmod 0440 /etc/sudoers'
chuck 62->editsudo
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting
sudo visudo
. Before justvisudo
worked but I'm not sure why. I thought thesudo
command was part of thevisudo
editor. And changing the editor was another thing I was going to do but visudo was ignoring the EDITOR and VISUAL env vars. – Bulrush May 09 '16 at 16:55