Segmentation fault after sudo commands
-
22-02-2021 - |
Вопрос
I've modified (in some wrong way) the file etc/sudoers
in my Mac OS X 10.6.8.
For this reason I've erased the wrong line and replaced the original file. But now whenever I type sudo commands the output is:
sudo: /etc/sudoers is owned by uid 501, should be 0
Segmentation fault
A solution could be this but when I type su
(and the password) the output is:
su: Sorry
How can I fix this problem?
Решение 2
I've followed these steps to enabling and using the "root" user in Mac OS X.
In this way I can use the fix posted in my question.
Другие советы
For the record, there is an easier way to fix this on OS X: run Disk Utility, select the volume in the sidebar, then the First Aid tab, and click Repair Disk Permissions. /etc/sudoers is one of the system files it knows the "correct" permissions for, so it'll take care of it for you.
You'll need to login as root
directly, or boot into a root
console, in order to change the ownership of the /etc/sudoers
file.
Try sudo -u root vim /etc/sudoers
, replacing 'root' with the user that you were logged in as when originally modifying /etc/sudoers
. Then make any needed changes, save and quit, and try again.
I ran into this issue when adding source ~/.bash_profile
to my ~/.bashrc file while logged in as root. Running sudo -u root vim ~/.bashrc
as a non-root user and deleting the source ~/.bash_profile
line fixed my issue.