I attempted to add myself to the sudoers file a couple of days ago. I didn't want to have to login into root to do anything so I went into the file and inserted my name under root. Now I cannot use the sudo command even when I'm logged into root. Does anyone know how to resolve this issue?
-
1What distribution?– jdwolfDec 28, 2017 at 21:26
-
I'm using fedora server. I get this message: >>>/etc/sudoers: syntax error near line 99 <<< sudo: parse error in /etc/sudoers near line 99 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin.– Sidney UptonDec 28, 2017 at 21:33
1 Answer
First
su root
Use
EDITOR=nano visudo
To fix the file yourself. Or
rm /etc/sudoers
On Debian:
apt-get --reinstall install sudo
On Fedora:
yum reinstall sudo
Then do things the right way:
usermod -aG sudo,wheel [user]
Then
exit
sudo whoami
-
I got this error when I typed in the line after the rm command. bash: apt-get: command not found. Dec 28, 2017 at 21:36
-
-
One more question. Do I delete this post now since it got answered? Or do I just leave it? Dec 28, 2017 at 21:41
-