File ownership in %install

Frank Steiner fsteiner-mail1 at
Mon Jun 15 09:15:55 UTC 2020

The behaviour has changed between rpm 4.9 and 4.10 as I could
figure out by installing the old versions from opensuse.

If you want to keep using "install -o .. -g .." to avoid
naming all files explicitely in %files, you can use sth. like

find $RPM_BUILD_ROOT -not -type d -printf '%%attr(%m,%u,%g,%m) "/%P"\n' >files.list

%files -f files.list


Frank Steiner wrote:

> Hi,
> when I started with my own spec files many years ago I always used
> lines like
> install -o mysql -g mysql -m 700 blabla $RPM_BUILD_ROOT/...
> and I'm pretty sure that the file blabla belonged to mysql:mysql
> after installation of the rpm, although it was not mentioned in
> %files with any attr. Actually, we always collect the list of
> files with a find command and use "%files -f files.list", so
> attr/defattr is never used.
> With a new RPM I wrote recently I used install lines with owner
> and group like above, but all files belong to root:root after
> installation and I couldn't find any way to change that except
> using attr/defattr in %files.
> Has this behaviour changed at some time in the past? Or is my
> remembrance just wrong?
> cu,
> Frank

Dipl.-Inform. Frank Steiner   Web:
Lehrstuhl f. Bioinformatik    Mail:
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *

More information about the Rpm-list mailing list