jampolis
asked on
"root is not in sudoers list". How do I get sudo to work?
Not having much luck in the Mac area. I can't do any sudo commands, because both my admin username and "root" are not on sudoers list!
Since I can't get into sudo using root, how can I get myself back on the list?
Very perplexing.
Since I can't get into sudo using root, how can I get myself back on the list?
Very perplexing.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> how do I navigate <<
Use "vidudo" as I wrote.
>> need to get to private/... <<
Where's the problem? root can do that without sudo, and once you added your userid to sudoers with appropriate privileges you can do that with sudo.
wmp
Use "vidudo" as I wrote.
>> need to get to private/... <<
Where's the problem? root can do that without sudo, and once you added your userid to sudoers with appropriate privileges you can do that with sudo.
wmp
ASKER
Last login: Wed Mar 23 11:07:09 on ttys000
-sh-3.2$ visudo
visudo: /etc/sudoers: Permission denied
visudo: /etc/sudoers: Permission denied
-sh-3.2$ su root
Password:
sh-3.2# visudo
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/sudoers.tmp" 0L, 0C
WHAT NOW?
-sh-3.2$ visudo
visudo: /etc/sudoers: Permission denied
visudo: /etc/sudoers: Permission denied
-sh-3.2$ su root
Password:
sh-3.2# visudo
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/sudoers.tmp" 0L, 0C
WHAT NOW?
You don't have a sudoers file yet, and visudo opened an empty one for you.
This is a bit strange, normally there is a sample file.
Anyway, "man sudoers" should have lots of examples.
Add
userid ALL = (ALL) ALL
for your own userid as a start.
This is a bit strange, normally there is a sample file.
Anyway, "man sudoers" should have lots of examples.
Add
userid ALL = (ALL) ALL
for your own userid as a start.
ASKER
Last login: Wed Mar 23 12:08:30 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo -f /etc/sudoers
iNPJ ALL = (ALL) ALL
root ALL = (ALL) ALL
:w! etc/sudoers
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --
Last login: Wed Mar 23 12:13:40 on ttys001
-sh-3.2$ su root
Password:
sh-3.2# sudo nano etc/hosts
root is not in the sudoers file. This incident will be reported.
sh-3.2#
???????????? WHAT DID I DO WRONG?
-sh-3.2$ su root
Password:
sh-3.2# visudo -f /etc/sudoers
iNPJ ALL = (ALL) ALL
root ALL = (ALL) ALL
:w! etc/sudoers
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --
Last login: Wed Mar 23 12:13:40 on ttys001
-sh-3.2$ su root
Password:
sh-3.2# sudo nano etc/hosts
root is not in the sudoers file. This incident will be reported.
sh-3.2#
???????????? WHAT DID I DO WRONG?
Why did you use "-f /etc/sudoers"?
Why did you issue "w! /etc/sudoers"?
visudo manages the sudoers file on its own. Let it do its work.
What do you get with "cat /etc/sudoers"?
And why in the world do you insist in using sudo when logged in as root? It doesn't make sense, I keep telling you!
wmp
Why did you issue "w! /etc/sudoers"?
visudo manages the sudoers file on its own. Let it do its work.
What do you get with "cat /etc/sudoers"?
And why in the world do you insist in using sudo when logged in as root? It doesn't make sense, I keep telling you!
wmp
ASKER
OK OK As you can tell, I'm new at this. I'll try it as you say.
ASKER
I saw those commands in man visudo. Sorry. I don't know how to save the edit when it's done.
ASKER
Last login: Wed Mar 23 12:21:53 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo cat/etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
sh-3.2#
-sh-3.2$ su root
Password:
sh-3.2# visudo cat/etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
sh-3.2#
:wq
cat /etc/sudoers
NOT
visudo cat ...
NOT
visudo cat ...
ASKER
without the -F
ASKER
Without the -f
Last login: Wed Mar 23 12:56:47 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo /etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
sh-3.2# iNPJ ALL = (ALL) ALL
sh: syntax error near unexpected token `('
sh-3.2#
Last login: Wed Mar 23 12:56:47 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo /etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
sh-3.2# iNPJ ALL = (ALL) ALL
sh: syntax error near unexpected token `('
sh-3.2#
ONLY visudo
WITHOUT ANY PARAMETER
WITHOUT ANY PARAMETER
ASKER
OK. Here's as far as I've gotten. The file (sudoers.tmp) is open on my desktop.
How do I finish, and how do I then edit /private/etc/hosts ?
Last login: Wed Mar 23 13:12:41 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo /etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
sh-3.2# visudo -f sudoers
iNPJ ALL = (ALL) ALL
root ALL = (ALL) ALL
:wq
:wq
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --
How do I finish, and how do I then edit /private/etc/hosts ?
Last login: Wed Mar 23 13:12:41 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo /etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
sh-3.2# visudo -f sudoers
iNPJ ALL = (ALL) ALL
root ALL = (ALL) ALL
:wq
:wq
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --
Seems that you don't know how to work with vi.
Sorry, I've not been aware of this fact.
In your present situation it's best to hit the "escape" key and to type :q! afterwards. You will get back to your shell.
Now issue visudo
Please post what you see.
Sorry, I've not been aware of this fact.
In your present situation it's best to hit the "escape" key and to type :q! afterwards. You will get back to your shell.
Now issue visudo
Please post what you see.
ASKER
Last login: Wed Mar 23 13:14:29 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo /etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
visudo: sudoers.tmp unchanged
sh-3.2#
-sh-3.2$ su root
Password:
sh-3.2# visudo /etc/sudoers
usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]
visudo: sudoers.tmp unchanged
sh-3.2#
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Last login: Wed Mar 23 17:48:45 on ttys000
-sh-3.2$ su root
Password:
sh-3.2# visudo
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/sudoers.tmp" 0L, 0C
-sh-3.2$ su root
Password:
sh-3.2# visudo
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/sudoers.tmp" 0L, 0C
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Woolmilkporc was very patient and kept trying in the face of my ignorance.
Tintin summed it all up neatly and it all works just fine!
Tintin summed it all up neatly and it all works just fine!
ASKER
Also, how do I navigate to the sudoers file to edit/add to it?