11

Where is the sudoers file in Solaris? Is it different between Solaris versions (specifically, 9 and 10)?

10

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.

2
  • That doesn't tell me where I can find the sudoers file in the file system.
    – Jon Kruger
    Feb 11 '11 at 18:33
  • 5
    It's right there in the last line of the output!
    – Alnitak
    Feb 11 '11 at 18:36
7

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
  • 4
    One 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
3

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
  • 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 5:10
2

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.

1

It's under /usr/local/etc on my Oracle Solaris 10 1/13 s10x_u11wos_24a X86 system. There was no visudo command.

0

instead of sudo, you can use

su -

1
  • 1
    That'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 5 '11 at 21:20
-1

/opt/csw/etc/sudoers is path....

2
  • 3
    Not 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
  • @HBruijn which for some reason I just got downvoted for :(
    – Alnitak
    Nov 20 '15 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.