1833875 Members
1882 Online
110063 Solutions
New Discussion

visudo error

 
zsujith
Frequent Advisor

visudo error

Hello,

When we execute visudo command the following error is as shown below.

# /usr/local/sbin/visudo
/usr/local/sbin/visudo: /usr/local/etc/sudoers: Permission denied

Thanks & Regards
"The most wasted day is that in which we have not laughed."
10 REPLIES 10
Ivan Krastev
Honored Contributor

Re: visudo error

Only root can use visudo. Or someone who already have access configured in sudoers.

regards,
ivan
Siju Vadakkan
Trusted Contributor

Re: visudo error

Check the permission of sudoers file

ll /usr/local/etc/sudoers
zsujith
Frequent Advisor

Re: visudo error

Hello,

We get the premission denied error when we execute through root login also.

The permission of sudoers file is as shown below.

# ls -lt /usr/local/etc/sudoers
-r--r----- 1 root root 1551 Mar 14 04:20 /usr/local/etc/sudoers

Regards
"The most wasted day is that in which we have not laughed."
Ivan Krastev
Honored Contributor

Re: visudo error

Add u+w (write) permissions:

chmod u+w /usr/local/etc/sudoers


regards,
ivan
Siju Vadakkan
Trusted Contributor

Re: visudo error

make the permission as 644

chmod 644 /usr/local/etc/sudoers
Mounaam
Trusted Contributor

Re: visudo error

Hi,

don't change the permissions of sudoers, but check perms and owner of sudo binary. It must have:
-rwsr-xr-x root/root
zsujith
Frequent Advisor

Re: visudo error

Hello,

The permission of 3 files are shown below.

ls -lt /usr/local/bin/sudo
---s--x--x 1 root users 95716 Dec 3 2000 /usr/local/bin/sudo
$ ls -lt /usr/local/sbin/visudo
-rwxr-xr-x 1 root users 69780 Dec 3 2000 /usr/local/sbin/visudo
$ ls -lt /usr/local/etc/sudoers
-r--r----- 1 root root 1551 Mar 14 04:20 /usr/local/etc/sudoers

The same permission are there in other 2 servers and there visudo is working fine.

Waiting for your reply.

Regards
"The most wasted day is that in which we have not laughed."
Ralph Grothe
Honored Contributor

Re: visudo error

Ownership root:root and perms 0440 of the sudoers file
is perfectly ok, and shouldn't be changed at all.
If you haven't changed Defaults in sudoers
then you could look at the logfile where your syslogd auth facility is being logged to for any hints why visudo is rejecting you.
Madness, thy name is system administration
Mounaam
Trusted Contributor

Re: visudo error

Hi,

sorry I made a mistake on my last post:
I gave you permission of sudo binary and not visudo.

Can you check that you have write permission on directory: /usr/local/etc/

and finally execute strace -o /tmp/out.txt visudo
and search for a syscall that is returning an error like EACCES or EPERM.
Dennis Handly
Acclaimed Contributor

Re: visudo error

>Mounaam: finally execute strace

On HP-UX you want tusc:
tusc -fp -o /tmp/out.txt visudo