Skip to content
Advertisement

Editing the sudoers file on Mac or Linux when you have no permissions

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

Advertisement

Answer

You need to be root (or have rootprivileges) in order to use the visudo command and edit the sudoers file

Advertisement