# CPack RPM change file ownership

**URL:** https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174
**Category:** Usage
**Created:** [April 19, 2021, 4:42pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174 "2021-04-19T16:42:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [April 19, 2021, 4:42pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174/1 "2021-04-19T16:42:29Z")

</div>

I need to add a file to my project package to perform network configuration using [NetworkManager](https://access.redhat.com/solutions/2841131) (RHEL). The requirements for this file are that it be owned by root, not writable by group/other, and executable.

I know I can set the permissions with the `install` command, but how do I change owner? If I were writing the spec file, this would be a simple `%attr(755, root, root)` command, but CPack doesn’t seem to (obviously) support that.

Am I missing something?

---

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [April 19, 2021, 4:47pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174/2 "2021-04-19T16:47:41Z")

</div>

maybe it’s a non-issue, because apparently, `yum` installs files owned by root by default, but it begs the question if I wanted other files **not** owned by root, how would I do that?

---

<div class="post-metadata">

### Author: ![erk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/erk/32/114_2.png) [@erk](https://discourse.cmake.org/u/erk)
#### Post date: [April 19, 2021, 4:48pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174/3 "2021-04-19T16:48:43Z")

</div>

For RPM you can try to set CPACK\_RPM\_USER\_FILELIST  
cf: [https://cmake.org/cmake/help/v3.19/cpack\_gen/rpm.html#cpack\_gen:CPack%20RPM%20Generator](https://cmake.org/cmake/help/v3.19/cpack_gen/rpm.html#cpack_gen:CPack%20RPM%20Generator)

---

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [April 19, 2021, 4:51pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174/4 "2021-04-19T16:51:25Z")

</div>

Perfect. Thank you. I’m pretty sure I read through that whole page but just failed to comprehend that variable.

---

<div class="post-metadata">

### Author: ![erk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/erk/32/114_2.png) [@erk](https://discourse.cmake.org/u/erk)
#### Post date: [April 19, 2021, 5:04pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174/5 "2021-04-19T17:04:51Z")

</div>

No problem.  
Documentation patch/contribution is accepted too 😃

---

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [April 19, 2021, 5:06pm UTC](https://discourse.cmake.org/t/cpack-rpm-change-file-ownership/3174/6 "2021-04-19T17:06:48Z")

</div>

the sad part is, I already had it in my CMakeLists.txt file, but just for the `%config` directives.
