Ask Your Question
0

Proper way of invoking privileged yum operations from a program

asked 2012-06-04 22:06:52 -0500

I'm writing a utility that would need to perform privileged Yum operations -- triggering installations, enabling and disabling repositories, etc.

What's the recommended way of doing privilege escalation for this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-06-05 01:28:03 -0500

ztank1013 gravatar image

I think you may use sudo. But don't forget of a the following things:

  • if you need to run yum unattended in your script you will need to include -y options with many yum commands like yum install, or your script will hang forever waiting for an interactive answer.
  • Also if you are running the script as a non root user you should edit in /etc/sudoers file and give to the user which is running the script the power to run yum as super user without the need to type a password (NOPASSWD option).
  • Finally, don't forget of the very verbose output yum usually has. It can be distracting sometimes and out of the goal of your script. I will consider to suppress it redirecting its outputs (stderr and/or stdout) to /dev/null
edit flag offensive delete link more

Comments

1

If you are referring to making a program using the yum api, please talk to folks on the yum devel mailing list: http://lists.baseurl.org/mailman/listinfo/yum-devel

FranciscoD_ gravatar imageFranciscoD_ ( 2012-06-05 03:34:56 -0500 )edit

Question Tools

Stats

Asked: 2012-06-04 22:06:52 -0500

Seen: 183 times

Last updated: Jun 05 '12