gpt4 book ai didi

centos - 打包RPM时如何设置已安装(谁在安装RPM)用户和组权限

转载 作者:太空宇宙 更新时间:2023-11-03 17:18:50 28 4
gpt4 key购买 nike

I am just wondering if there is a way to specify the current user(who is installing the RPM) user:group privileges to installed folder of RPM(/usr/lib/appfloder) in the Spec(.spec) file.

示例:当前在安装 RPM 时它正在考虑 root:root 权限,如果我们不创建用户和组并且未在部分中添加(%defattr(777, maya, maya, 777)) 在规范文件中。如果我们添加 defattr,它会将 maya 视为用户。

Expecting, please consider the current user 'user1' is installing the RPM, the privileges should under 'user1'. if 'user2' is installing the RPM it should under 'user2'.. Why?

I have an RPM package which install on /usr/lib/app and run as a service. And my application needs the current user home directory to search for some package which is installed for the current user.

最佳答案

安装 rpm 的用户始终是 root,因为您需要 root 权限才能安装 rpm。

所以你不能这样做。您需要找到其他方式,包不应在用户的 /home 目录中提供文件。如果您有通用配置要打包;把它放在 /etc 中。

关于centos - 打包RPM时如何设置已安装(谁在安装RPM)用户和组权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57686679/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com