Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This page contains a prominent warning:

Important

Never build RPMS as root.

Why is it bad to build RPMs as root? Is it the possibility of overwriting some files? Are there file permissions problems?

share|improve this question

4 Answers 4

up vote 22 down vote accepted

Badly written RPM .spec files (or even well-written ones with a typo) can do improper things such as:

  • Install directly to the running system instead of to a sandbox
  • Leave junk on the filesystem
  • Accidentally run nasty commands such as: rm -rf ${RPM_BUILD_ROOT}

There is no part of the RPM build process that actually needs root access. So, we should follow the standard procedure of "If it doesn't need root permission, it doesn't run as root" when building RPMs.

This avoids nasty accidents and surprises.

share|improve this answer

When I am searching over INTERNET I got the reasons for your question in the following link http://pmc.ucsc.edu/~dmk/notes/RPMs/Creating_RPMs.html

It is waring only to avoid the accidental mistakes or unintentional stuff .

share|improve this answer
1  
Welcome to Server Fault! Generally we like answers on the site to be able to stand on their own - Links are great, but if that link ever breaks the answer should have enough information to still be helpful. Please consider editing your answer to include more detail. See the FAQ for more info. –  slm Apr 1 '13 at 15:11

mock for fedora is pretty nice, too. If it'll build in mock, chances are it's a pretty clean RPM.

share|improve this answer
    
FWIW, having worked with Red Hat before, I know they demand that an RPM builds in Mock before they're accept it into their build environment. I think the same applies to the Fedora Project as well. –  EmmEff Aug 31 '09 at 1:40

Generally you should never use the root user except you really need the rights. But you are right the main problem would be that 'rpmbuild' would execute nearly everything you wrote into a spec file. (override files, create users, delete files etc.).

Edit:

As a side note I would suggest to take a look at the openSUSE Build Service which makes building rpms for different distributions really easy. (It can also set up as a local instance.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.