我试图在我的Mac上安装一些东西但我没有获得许可,因为我不是管理员。所以我尝试使用sudo,它说我不在sudoers文件中。我已经尝试过编辑sudoers文件,但它不会让我,所以我用谷歌搜索了#34;它。每个人都说使用visudo来编辑文件。问题是,它甚至不让我使用visudo!当我输入" visudo"它只是说
visudo: /etc/sudoers: Permission denied
会感激一些帮助。提前谢谢!
编辑:我尝试切换用户然后编辑sudoers文件但仍然无法正常工作
答案 0 :(得分:2)
您需要root
(或拥有root
权限才能使用visudo
命令并编辑sudoers
文件
答案 1 :(得分:0)
如果你搞砸了你的sudoers文件。你需要:
来源: - http://mario.net.au/content/recover-etcsudoers-ubuntu-1204
答案 2 :(得分:0)
您必须是root用户或使用sudo编辑sudoers文件。
sudo visudo
答案 3 :(得分:0)
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.
1. Restart your mac
2. Hold on to Command-R two keys until you see the progress bar.
3. Start a new terminal, this terminal will be the root terminal
4. Edit the invalid sudoers file. Note this file is not in /etc/sudoers when you loggedin in as root
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