1752777 Members
6290 Online
108789 Solutions
New Discussion юеВ

Re: sudo

 
Mehmood Ansari
Frequent Advisor

sudo

Hi
I need help to use sudo. HP 11.11 I am login as [oper] within the menu I want to run fbackup and reboot system. sudoers file I defined oper, but I could not run the backup and reboot system. Please guide me where is there is something missing in sudoers file. File is attached.

Thanks and regards
14 REPLIES 14
Slawomir Gora
Honored Contributor

Re: sudo

Hi,

your syntax for user oper is correct
(in my opinion there are to much priviliges for user oper)

and if you want to shutdown system by sudo
you need to change directory to /

ex:
cd /; /opt/sudo/bin/sudo /sbin/shutdown -r 0

change your path to sudo




Peter Leddy_1
Esteemed Contributor

Re: sudo

Hi,

I'm not sure if this will make a difference but it could.
Instead of

oper ALL=(ALL) NOPASSWD:ALL

try

oper ALL=(ALL) NOPASSWD: ALL

which has a space before the last ALL.

Regards,

Peter
Ravi_8
Honored Contributor

Re: sudo

Hi

#visudo
this will open sudoers file, at the end add the lines
%users ALL=fbackup reboot
save and close the file.

login as the user, now you can use fbackup and reboot command
never give up
Mehmood Ansari
Frequent Advisor

Re: sudo

Hi
No it is not working, file attached.
operAll=(ALL)NOPASSWD: ALL giving error &
%user ALL=fbackup reboot is also giving error both parameter cannot be add in visudo.
Sanjay_6
Honored Contributor

Re: sudo

Hi,

oper ALL=(ALL) NOPASSWD: ALL

In your sudoers file there is no space between oper and ALL.

for fbackup & reboot commands give the path. IT may prompt you to give your password while running this command.

%user ALL=/usr/sbin/fbackup,some_path/reboot

this will allow everyone in the user group to have the ability to run this command as root using sudo.

Hope this helps.

Regds
Indira Aramandla
Honored Contributor

Re: sudo

Hi Mehmood,

You need to run fbackup and reboot as user oper.

Use visudo to open the sudoers file in vi mode and add the following lines.

# Host alias specification
(This is where you sepcify the alias name to the server hostname
eg:- if your hostname of the server is devtest
Host_Alias TEST = devtest

# User alias specification
(This is where you specify the user alias who will execute the commnad / script)
User_Alias BACKUP_USER=oper

#Runas alias specification
(This is where you specify the original user
Runas_Alias BACKUP = root

# Cmnd alias specification
(This is where you specify the command or script with the command)
Cmnd_Alias SYSTEM_BACKUP = /path_name/script_name

# User privilege specification
(This is where you specify the user and the command alias)
BACKUP_USER TEST = (BACKUP) NOPASSWD: SYSTEM_BACKUP

Attached is the sudoers file that I entered some examples.

I hope this helps

Indira A
Never give up, Keep Trying
Mehmood Ansari
Frequent Advisor

Re: sudo

Hi

I am trying it, still it is not working. I did some changes, file is attached. Is there is any thing has to be modified on some other file system.

Regards
Indira Aramandla
Honored Contributor

Re: sudo

Hi Mehmood,

There are two modifications. The modifications are under the sections
# User alias specification and # User privilege specification

I modified your file and attached.


Indira A
Never give up, Keep Trying
Mehmood Ansari
Frequent Advisor

Re: sudo

Hi
Indira
I try as per your modification, it did not work. Tell me do I uninstall and install sudo again, or is there is any file has to be modified other than sudoers.

Regards