Operating System - HP-UX
1833459 Members
3103 Online
110052 Solutions
New Discussion

Trying to run SAM with SUDO.

 
SOLVED
Go to solution
Jeff Souter
Frequent Advisor

Trying to run SAM with SUDO.

I am trying to configure SUDO so that i can lock down root access, but i cannot get sudo to recognise the sam command.
In the sudoers file i have the command line as /usr/sbin/sam.
But when i run sudo sam it gives me the error (sudo: sam: command not found.
Any ideas anyone.

Thanks
Jeff
15 REPLIES 15
Michael Elleby III_1
Trusted Contributor

Re: Trying to run SAM with SUDO.

Jeff-

All you need to do here is to configure Restricted Sam.. (run sam -r as root)

When you run restricted sam, you can give the user access to any root functions in sam and deny other functions that you don't wish them to execute.

Mike Elleby
Knowledge Is Power
Jeff Souter
Frequent Advisor

Re: Trying to run SAM with SUDO.

Thanks for the reply Mike but it's not the answer i was looking for, i don't want users to go anywhere near root therfore the need to use SUDO.

Jeff
Michael Elleby III_1
Trusted Contributor

Re: Trying to run SAM with SUDO.

Jeff-

Restrictied Sam Builder is what is used to give non-root users access to root functions in sam without giving them root access.

The user(s) that you configure would login as themselves and run Sam, but would only be allowed to execute functions in Sam that you authorize.

Just wanted to give you an idea to use..

Hope this helps..

Mike Elleby
Knowledge Is Power
Michael Elleby III_1
Trusted Contributor

Re: Trying to run SAM with SUDO.

I almost forgot...

Sorry it wasn't what you were looking for...

Mike...
Knowledge Is Power
Sridhar Bhaskarla
Honored Contributor

Re: Trying to run SAM with SUDO.

Hi Jeff,

You probably do not have /usr/sbin in your secured-path of sudoers file.

Did you try using the full path?.

sudo /usr/sbin/sam

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Paula J Frazer-Campbell
Honored Contributor

Re: Trying to run SAM with SUDO.

Hi
Whilst Michael did not answer your initial question he has given you a more secure and correct way to allow users controlled (restricted) sam.


Paula

If you can spell SysAdmin then you is one - anon
Jeff Souter
Frequent Advisor

Re: Trying to run SAM with SUDO.

Hi Sri

Yes if type sudo /usr/sbin/sam it works no problem.
But not - sudo sam
However if i type eg - sudo make_recovery it works without having to put in the full path.

Not sure what you mean about the secure part in the sudoers file.

Jeff
Jeff Souter
Frequent Advisor

Re: Trying to run SAM with SUDO.

Hi Paula

Thanks for the reply, it's not sam i am looking to restrict but users access to root in general.

Thanks
Jeff
Paula J Frazer-Campbell
Honored Contributor

Re: Trying to run SAM with SUDO.

Jeff

I know what its like, you have to drag them kicking and screaming back to a normal login.

Have a serious look at restricted sam as you can build menus within to allow then to carry out almost anything.

AS root fire up sam and at first screen the options:_

Add Custom Application...
Add Custom Application Group...

are displayed.

HTH

Paula
If you can spell SysAdmin then you is one - anon
Sridhar Bhaskarla
Honored Contributor

Re: Trying to run SAM with SUDO.

Jeff,

It's the path you specify with the configure option (--secure_path) of SUDO while compiling it. It will overwrite the the PATH of the user executing SUDO.

/usr/sbin is not defined by default in ordinary user PATH. You can try it by exporting the PATH of the user to include /usr/sbin and then executing sudo.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Martin Johnson
Honored Contributor

Re: Trying to run SAM with SUDO.

SUDO is only as good/secure as it is configured. A sloppy configuration can leave security loopholes.

Restricted SAM as more restricted access and custom menus allow further restrictions.

For security reasons, I believe restricted SAm is the way to go.

HTH
Marty
Jeff Souter
Frequent Advisor

Re: Trying to run SAM with SUDO.

I think we are focusing too much on SAM here, yes i know how sam -r works, but it is not the only thing i need, i also need to run command lines as a root user.
I appreciate all the comments about sam, but a. i don't want everybody going into sam and b. i only need some users to run root command prompts.

I'm sorry if i have lost the plot abit here, i just wanted to know how to run sam with SUDO.

I have added a the PATH /usr/sbin/sam into the users .profile but still no joy.
Looks like i will have to type in the full path (sudo /usr/sbin/sam to get sam to work.

Thanks
Jeff
Anil C. Sedha
Trusted Contributor
Solution

Re: Trying to run SAM with SUDO.

Jeff,

Link your sudo to /usr/local/bin

Then add path to SAM

export PATH=$PATH:/usr/sbin

Run

sudo sam

I believe you should be good to go.

If you still get that error, try doing this

whereis sudo
/usr/local/bin/sudo

whereis sam
/usr/sbin/sam


I believe this will give you a good idea where sam is.

Regards,
Anil
If you need to learn, now is the best opportunity
Jeff Souter
Frequent Advisor

Re: Trying to run SAM with SUDO.

Thanks Anil
That cracked it.

Jeff
Sridhar Bhaskarla
Honored Contributor

Re: Trying to run SAM with SUDO.

Looks like you didn't read my message to manipulate the user's PATH but I am glad you had the problem fixed.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try