1753964 Members
7637 Online
108811 Solutions
New Discussion юеВ

sudo

 
Waqar Razi
Regular Advisor

sudo

I have installed sudo on rp-7420 server running hpux 11.11. I am having the following problem:

Whenever I use sudo to execute some command like su:

sudo su -

it gives me the following error:

/home/ubuaaia # sudo
sh: sudo: not found.

And when I give the full pathname of sudo like

/usr/local/bin/sudo su -

it executes successfully.

I want me and other users who have been granted sudo privilege (defined in sudoers file) can execute sudo by just typing sudo from their home directories or from any where else.How can I do that, please write the steps and commands to do that:

The second question I have how can I change the location of sudoers file from /usr/local/etc/sudoers to /etc/sudoers?


5 REPLIES 5
Kenan Erdey
Honored Contributor

Re: sudo

Hi,

add this line to /etc/profile

PATH=$PATH:/usr/local/bin
export PATH

>The second question I have how can I change the location of sudoers file from /usr/local/etc/sudoers to /etc/sudoers?

making a soft link is the easy way:

ln -s /usr/local/etc/sudoers /etc/sudoers

Kenan.
Computers have lots of memory but no imagination
Waqar Razi
Regular Advisor

Re: sudo

to .profile of every user?
Asif Sharif
Honored Contributor

Re: sudo

Salam Waqar,

As per earlier response just the path in "/etc/profile" and export it.

PATH=$PATH:/usr/local/bin
export PATH

You can add this path in "/etc/PATH" also.

Regards,
Asif Sharif
Regards,
Asif Sharif
Bill Hassell
Honored Contributor

Re: sudo

This is a more general question. Typing the filename (just like DOS on PCs) is only meaningful when the predefined PATH has the required directory listed. sudo is meaningless if it is not located in your PATH variable. Because you have sudo installed in /usr/local/bin, the default PATH for every user (which is stored in /etc/PATH) does not contain /usr/local/bin. That is because /usr/local/bin has been set to very bad permissions (777) for decades and is therefore not to be trusted as a source for executables. The comments for this still exist in most HP-UX default profiles.

So, no, you don't have to put /usr/local/bin in everyone's .profile. But before you do, be sure to run this command to fix the errors in the /usr/local directories:

find /usr/local -type d -exec chmod 755 {} \;

And now you can add /usr/local/bin to the /etc/PATH file. Now, everyone that logs in will see all the executables in /usr/local/bin and be protected by proper permissions for the directories.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: sudo

>to .profile of every user?

Yes. There shouldn't be that many users using sudo? Also if they are too lazy to type the full path, they should be smart enough to be able to change their own .profile.
Just provide them a tested example.

As mentioned by Bill and Asif, you could put it in /etc/profile and /etc/PATH but I don't want /usr/local/bin/ at the beginning of my PATH, hiding the normal HP-UX linker tools with foreign devil versions.