1840181 Members
2768 Online
110162 Solutions
New Discussion

Sudo

 
Mehmood Ansari
Frequent Advisor

Sudo

Hi

Still I could not solve the problem with sudo. I need help. There is attachment file for review.

Regards
9 REPLIES 9
Mohanasundaram_1
Honored Contributor

Re: Sudo

Hi ,

Can you please explain your problem? I do not see any posts before this message about your problem.
Attitude, Not aptitude, determines your altitude
Sridhar Bhaskarla
Honored Contributor

Re: Sudo

Hi Mohammad,

The error says that you are trying to execute sudo as root. Since root is not defined in your sudoers file (unless you make root as part of cmsoper group or add root to your User_Alias), it gave you the error. Why would you use sudo for root anyway?.

To make it simple, add these lines to your sudoers and see if they work for you.

Cmnd_Alias MYCMDS = /usr/sbin/fbackup, /usr/sbin/frecover, /usr/sbin/shutdown

%cmsoper ALL = (root) NOPASSWD: MYCMDS

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

Re: Sudo

Hi Sridhar

I did changes as you mentioned. When I run sudo it says that

[cmsprod,cmsoper,ORCL,/]>/usr/local/bin/sudo shutdown
User root not allowed to shutdown this system (cmsprod) -- exiting shutdown.
[cmsprod,cmsoper,ORCL,/]>
[cmsprod,cmsoper,ORCL,/]>

Please check the attachment file.
Regards
Sridhar Bhaskarla
Honored Contributor

Re: Sudo

Hi Mohammad,

Looks like you configured /etc/shutdown.allow and didn't add root in it. That file if exists and non-empty, should also have root included if you want to shutdown the system as root.

Either delete that file or add root to it. This is not a problem with sudo.

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

Re: Sudo

What does it says in the "/etc/shutdown.allow" file?
Mehmood Ansari
Frequent Advisor

Re: Sudo

Hi Srighar

I did run before removing /etc/shutdown.allow and after removing /etc/shutdown.allow. Please check attachment file.

Thanks & Regards
Bill Hassell
Honored Contributor

Re: Sudo

With the shutdown.allow file in place, the error seems to indicate that your current login is already root or that cmsoper has a UID of 0. sudo should not be used except with ordinary users. Login as cmsoper and run the command: id

There may also be a special character in the shutdown.allow file. List the file with the command:

xd -xc /etc/shutdown.allow

With the second message, you must cd to a root directory (such as /home, not /home/cmsoper or the / directory) before issuing the shutdown command.


Bill Hassell, sysadmin
Sridhar Bhaskarla
Honored Contributor

Re: Sudo

OK. You are almost there. Removing (renaming) shutdown.allow worked for you as the message now you are getting is different. You cannot shutdown the system from any mounted system other than root's. So, do a 'cd /' before you issue the sudo command.

On the other hand, if the idea is to only allow users to shutdown,fbackup and frecover you can use "restricted sam" feature. Run "sam -r" as root and enable *only* the tools that you want the others to execute.

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

Re: Sudo

Hi Sridhar
Thanks with cd / before sudo it is working fine. First I started with sam -r I faced problem, than expert people like you in this forum suggest me to use sudo. Well shutdown reboot is working. I did try sam -r the problem is I could not exit the sam. What is hapenning is within the operator menu it is calling sam -r menu, which has two custom application say [fbackup/frecover]. I run fbackup it works fine without error. After complete the fbackup it is backup to sam menu, when I try to exit sam it is running fbackup again with some files error. It finished normal and exit from sam.

What I understand first when I run fbackup it running through sam -r , when I try to exit sam it is running again, which is running from /home/cmsoper with some files error. Could you tell me where I am making error.

Thanks