Solved

RPM %defattr not working

Posted on 2011-09-09
7
471 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
  • 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Guacamole cut and paste issue 3 49
linux pull logs and export FTP 4 61
Choosing CentOS 16 59
wipe a usb using python 5 30
In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now