Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RPM %defattr not working

Posted on 2011-09-09
7
Medium Priority
?
528 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.
Suggested Courses

636 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