I'm trying to install something on my MacOS (or Linux) system and I don't have permission because I'm not the admin. So I tried using sudo
and it says that I'm not in /etc/sudoers
file. I've tried editing the sudoers
file but it won't let me, so I "googled" it. Everybody says to use visudo
to edit the file. The problem is, it won't even let me use visudo
! When I type "visudo" it just says
visudo: /etc/sudoers: Permission denied
Would appreciate some help. Thanks in advance!
EDIT: I tried switching users and then editing the sudoers file but still didn't work
You have to be root or use sudo to edit the sudoers file.
I am new to mac. Very annoyed by the time=0 for sudoer (you havew to type the password every time you use sudo). I want to increase this value to a reasonable number: timestamp_timeout=30. After adding the above line to the /etc/sudoers file, I could not login as su anymore because the parser fails to read the sudoers file. This posting is to document how I fix this problem.
The full path is: /Volumes/Macintosh HD/etc restart then you are happy again.
This method will also apply to users who are not in the sudoers list and want to add themselves to the list.
Note: if you could not find the sudoers file as root use find:
find / -name sudoers
If u messed up your sudoers file.You'll need to:
source :- http://mario.net.au/content/recover-etcsudoers-ubuntu-1204
You need to be
root
(or haveroot
privileges) in order to use thevisudo
command and edit thesudoers
file