Solved

RPM %defattr not working

Posted on 2011-09-09
7
501 Views
Last Modified: 2012-05-12
I'm installing an RPM package with a package.spec that tries to use the %defattr to set permissions and ownership for all files.  This is from package.spec:

%files
%defattr(0755,someId,user)
/base/runtime/standalone/listener.jar
/base/runtime/standalone/service.jar
/base/runtime/standalone/snap.jar

The rpm installation is done with scsudo like this:

scsudo root -i --prefix /home/userId test-5-1.0.noarch.rpm

The files get created correctly, but the owner/group is root/root.

Does anyone understand what might be wrong here?
0
Comment
Question by:jkavx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36514550
Do the user and group listed in %defattr exist on the system?
0
 

Author Comment

by:jkavx
ID: 36514606
Yes.
0
 

Author Comment

by:jkavx
ID: 36514894
The problem is that files are being set with the correct attributes but directories are not.  When I dirlled down I found that the 3 .jar files have the desired permissions, owner, group.  So let me change the question somewhat.  How do you list directores in the %files section.  If I do this:
%files
%defattr(0755,someId,user)
/base/runtime
/base/runtime/standalone
/base/runtime/standalone/listener.jar
/base/runtime/standalone/service.jar
/base/runtime/standalone/snap.jar

rpmbuild fails after warning that files are listed twice.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:Papertrip
ID: 36514908
try adding dir permissions at the end

%defattr(0755,someId,user,0775)

Open in new window

0
 

Accepted Solution

by:
jkavx earned 0 total points
ID: 36515163
No.  It doesn't work.  I'm finding I can set the %defattr, list all directories, and then use %attr for each listed file so that dirs can have one permission and files another.  
0
 

Author Closing Comment

by:jkavx
ID: 36534832
Found an approach that works.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36534843
Ah good call, that makes sense.

Good job!
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question