Make OS to look for sudoers to different path


 
Thread Tools Search this Thread
Operating Systems Solaris Make OS to look for sudoers to different path
# 1  
Old 06-10-2013
Make OS to look for sudoers to different path

This is for Solaris-11.
We have our customize sudoers to fulfill requirements and that is placed in /usr/local/etc/. Already removed /etc/sudoers, which comes with OS default. But OS it still looking for /etc/sudoers when I give sudo command. How to make him look into /usr/local/etc ?
Code:
root@prod_ora08 # ls -l /etc/sudoers /usr/local/etc/sudoers
/etc/sudoers: No such file or directory
-r--r-----   1 root     root       21431 May 29 13:47 /usr/local/etc/sudoers
root@prod_ora08 # sudo
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
root@prod_ora08 #

# 2  
Old 06-10-2013
That is a hardcoded path, as it should be. You would have to modify the source code and recompile.
# 3  
Old 06-10-2013
I believe there should be a way (or workaround), as all of other servers have sudoers at this path only.
# 4  
Old 06-10-2013
Two quick options that may work are to create a symlink:

Code:
ln -svf /usr/local/etc/sudoers /etc/sudoers

Or use the #include option to point to the other location. Create an empty /etc/sudoers file and add the following line:

Code:
#include /usr/local/etc/sudoers

# 5  
Old 06-10-2013
This is sudo, it has to be hardcoded. You can't just have people telling a login system to use a non-system config file, and you don't open a config file to figure out what file your config is.

Grep for /etc/sudoers and you'll find it in your sudo binary.

/usr/local/ is indeed where custom built things tend to go, so I remain confident they have a custom built sudo. Perhaps they found a way to deploy the same custom build across multiple machines. Perhaps the build is still sitting around in one of them.
# 6  
Old 06-10-2013
Yes, I am close now. We install SMCsudo in /usr/local and copy sudoers to /usr/local/etc/. Since base directory of SMCsudo will be /usr/local, it will look to its etc for sudoers.
But that we used to do on Solaris-10. I am not if this package is available for Solaris 11 or not.
-------------------------------------------------------------------------------------
Moreover, it seems soft link doesn't work
Code:
root@prod_ora08  # ln -s /usr/local/etc/sudoers /etc/sudoers
root@prod_ora08 # ls -l /etc/sudoers
lrwxrwxrwx   1 root     root          22 Jun 10 16:03 /etc/sudoers -> /usr/local/etc/sudoers
root@prod_ora08 # sudo
sudo: /etc/sudoers is not a regular file
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Jun 10 16:04:35 prod_ora08  sudo: [ID 702911 auth.alert]     root : /etc/sudoers is not a regular file ; TTY=pts/1 ; PWD=/root ;
root@prod_ora08  #


Last edited by solaris_1977; 06-10-2013 at 08:07 PM..
# 7  
Old 06-11-2013
You shouldn't mess with sudo which is used by the OS and assumes its configuration file is in /etc and in particular might use the /etc/sudoers.d/svc-system-config-user file depending on the installation method.

What's wrong with in2nix4life's suggestion ?

Code:
#include /usr/local/etc/sudoers

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

2. Programming

Boost library path for cmake & make

I was compiling a downloaded open source pkg. Following the install instruction, I did $ mkdir build; cd build; cmake ../; make but got error message:make: *** No rule to make target 'usr/lib64/lib64/libboost_graph-mt.so.5'. needed by ../bin.gam-create. stop make: *** Error 2 make: *** Error... (1 Reply)
Discussion started by: yifangt
1 Replies

3. UNIX for Dummies Questions & Answers

Make install in custom path

I would like to install a binary from source on a custom path, say /usr/local/myapps. There is no --prefix option in ./configure How can I "make install" at custom path. I tried this. No --prefix root@server # ./configure --help | grep prefix root@server # Make install ... (3 Replies)
Discussion started by: anil510
3 Replies

4. UNIX for Dummies Questions & Answers

Cannot make sudoers change work

I logged in as root and visudo'd /etc/sudoers. I found several users with the username ALL=(ALL) ALL entries and added an account after the last one. Saved the file. When the user logs in and does "sudo su -" they are prompted for their password and then told they are not in the sudoers file.... (8 Replies)
Discussion started by: rpm_on_lnx
8 Replies

5. Shell Programming and Scripting

how to make my own $PATH variable

hi all, i have to implement a mini-SHELL for a project in C++ i used "system()" to call bash functions found in $PATH i want to change this variable to $MYPATH, so, when i execute a coommand, the program will look for it in $MYPATH, not in $PATH how can i do it? (1 Reply)
Discussion started by: bismillah
1 Replies

6. UNIX for Dummies Questions & Answers

how to make my own $PATH variable

hi all, i have to implement a mini-SHELL for a project in C++ i used "system()" to call bash functions found in $PATH i want to change this variable to $MYPATH, so, when i execute a coommand, the program will look for it in $MYPATH, not in $PATH how can i do it? Double post (0 Replies)
Discussion started by: bismillah
0 Replies

7. Solaris

sudoers

what is the configuration file for sudo? can we edit it as like other file or will it create any adverse effect on editing that file? thanks in advance dinu (1 Reply)
Discussion started by: dinu
1 Replies

8. Shell Programming and Scripting

make file (include files path)

Hi All, In make file i want to include header files from my local directory and if it did not find in local directory i want to include from network directory. can any help me how i can do this?. here is the code INCLUDE=${include}/ this is point to network dir how i can add option that it... (1 Reply)
Discussion started by: goraya430
1 Replies

9. Shell Programming and Scripting

How would I make a find command NOT show the path of a file?

When I do find . -name "*.txt" -size +0 -exec ls {} \; I get something like ./lpi_stdout.txt ./lpi_stderr.txt What would I need to do or pipe it into to strip off those first two characters so I just get lpi_stdout.txt lpi_stderr.txt ? Thanks for the help! (1 Reply)
Discussion started by: LordJezo
1 Replies

10. Programming

HOW to make absolute path???? HELP

In the funtion C function link(char *existing, char *new); existing has to be an absolute path. But what happens if i want to make a ling to a file in the users home directory (assume file.txt exists) i cant put in a "~/file.txt" or "./file.txt" How can i turn the above into the entire path... (1 Reply)
Discussion started by: youngvet
1 Replies
Login or Register to Ask a Question