Solved

RPM %defattr not working

Posted on 2011-09-09
7
464 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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.

759 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

23 Experts available now in Live!

Get 1:1 Help Now