Where is the sudoers file in Solaris? Is it different between Solaris versions (specifically, 9 and 10)?
7 Answers
If you have sudo
, the visudo
command should tell you where the sudoers
file is.
$ sudo visudo -c
Password:
/etc/sudoers: parsed OK
see ^^^^
here.

- 21,191
- 3
- 52
- 82
-
That doesn't tell me where I can find the sudoers file in the file system. – Jon Kruger Feb 11 '11 at 18:33
-
5It's right there in the last line of the output! – Alnitak Feb 11 '11 at 18:36
Neither Solaris 9 or 10 include sudo - it wasn't bundled with Solaris until Solaris 11 - so for Solaris 9 & 10 the answer is “Whatever path was compiled into whatever version you installed.”

- 1,500
- 9
- 12
-
4One of the places to get sudo is OpenCSW. You can install a precompiled package. The sudoers file is then /etc/opt/csw/sudoers. – automaciej Feb 28 '12 at 18:40
Solaris has a more advanced privilege system than that. For example you can allow someone access to privileged ports without giving general root access. To do what sudo does, add the "Primary Administrator" profile to the user:
# usermod -P"Primary Administrator" someuser
And then under that user:
$ pfexec command
The profiles are defined in /etc/security/prof_attr. In there you'll see a list of the fine grained privileges in the profile. The user/profile assignments are in /etc/user_attr.

- 1,747
- 1
- 10
- 12
-
are you sure that it works like this in 9 and 10? I know this works in 11. I seem to remember RBAC only working in 9 if you had the special nerfed shell. – cwebber Feb 24 '11 at 05:10
It depends where it was compiled into sudo; it can basically be anywhere, as long as the sudo and visudo tools both know about it.
I tend to run
strings `which sudo`
(which may need privilege) when I want to know where system X keeps its sudoers file.

- 79,770
- 20
- 184
- 232
It's under /usr/local/etc
on my Oracle Solaris 10 1/13 s10x_u11wos_24a X86 system. There was no visudo
command.

- 77,029
- 24
- 135
- 201

- 11
- 1
instead of sudo, you can use
su -

- 9
- 1
-
1That's true but is generally not considered a good thing. Having people use sudo or RBAC and pfexec allows what they do to be logged and audited. – user9517 Mar 05 '11 at 21:20
/opt/csw/etc/sudoers
is path....

- 77,029
- 24
- 135
- 201
-
3Not universally though, (see the other answer with the suggestion to use `visudo` to find the specific path for your sudo build). – HBruijn Nov 20 '15 at 10:51
-