storing root password rpm spec file

Tony Nelson tonynelson at
Thu Dec 21 01:40:36 UTC 2006

At 11:52 PM +0100 12/20/06, Manuel Arostegui Ramirez wrote:
>El Miércoles, 20 de Diciembre de 2006 23:45, Tony Nelson escribió:
>> At 1:39 PM -0600 12/20/06, Mikkel L. Ellertson wrote:
>> >Manuel Arostegui Ramirez wrote:
>> >> I know (see above) :)
>> >>
>> >>> Getting the password interactively when doing an RPM install is a
>> >>> problem because of the design of rpm, and the fact that it may be
>> >>> running under a front-end program, or as part of a batch job. I can
>> >>> remember long threads about this in the past...
>> >>
>> >> Have you seen for example nagios-mysql (debian package) it asks for user
>> >> and password of the mysql, that's exactly what I want.
>> >
>> >No, I have not looked at it. But the problem you are running into is
>> >because of the differences in the packaging systems. The RPM install
>> >is designed to be run with no user interaction. This was a design
>> >decision early in the development of the RPM packaging system.
>> >
>> >It is possible to have an install script ask for information if you
>> >are doing a CLI installation, but you are not supposed to do it.
>> >This breaks down when you use one of the GUI front-ends for RPM, or
>> >use a batch job to install packages.
>> >
>> >One way around this is to have an install script that runs the first
>> >time the package is used. Another way is to have the install script
>> >detect what environment it being run in, and ether ask for the
>> >password (cli), pop up a windows asking for it (GUI), or do an error
>> >exit if it is being run from a batch file. You will also need to do
>> >the same thing in the update and un-install scripts. Keep in mind
>> >that you are not supposed to do this in an RPM...
>> I don't understand why a password is needed.  Installing a rpm is done as
>> root.  If some part of the rpm installation needs to run as a specific
>> user, just su to that user (no password required) and run any needed
>> commands as that user.  Use a subshell and nothing special needs to be done
>> after.
>No, I misunderstood myself. What I need is the root password of the mysql of
>the system where the rpm is gonna be installed.
>Why? Because I should run a sql file which will create some databases and some
>tables and it must be done with the root of the mysql.

When a RPM package is being installed, rpm is run by root.  Any scripts it
runs as part of the package, such as a post-install script, run as user
root.  Root can su to any other user.  Just use the su command in the
script.  No password is needed.
TonyN.:'    The Great Writ     <mailto:tonynelson at>
      '      is no more.             <>

More information about the users mailing list