attr directive in rpm spec
-
I understand what %attr and %defattr are doing in general.
What I am not clear on is what %attr does to sub files and folder when a directory is specified.
Does it apply it to all the files and folders recursively, or does it apply it to only the top level folder.
I am working on my install for NextCloud on CentOS and because they do not seem to have the clean RPM posted anywhere, I am trying to replicate what they have listed in their github repo for it.
Specifically here:
%files %defattr(0640,root,%{nc_group},0750) %attr(0755,root,%{nc_group}) %{nc_dir} %attr(0755,%{nc_user},%{nc_group}) %{nc_dir}/occ %attr(0750,%{nc_user},%{nc_group}) %{nc_dir}/apps %attr(0750,%{nc_user},%{nc_group}) %{nc_dir}/assets %attr(0750,%{nc_user},%{nc_group}) %{nc_dir}/updater %attr(0775,%{nc_user},%{nc_group}) %{nc_data_dir} %attr(0775,%{nc_user},%{nc_group}) %{nc_config_dir}
That %defattr means all files are
chmod 0640
while all directories arechmod 0750
and everything ischown root:apache
It seems that the directories subsequently specified are
chown apache:apache
and some arechmod 755
. But are those supposed to be recursive? -
This is my not cleaned up nor annotated notes so far to give perspective.
yum -y update yum install -y wget nano firewalld yum install -y epel-release systemctl start firewalld systemctl enable firewalld Install packages yum -y install httpd php-gd php-pdo php-pear php-mbstring php-xml php-pear-Net-Curl php-mcrypt php-intl php-ldap php-smbclient php-imap php-mysql php-pear-MDB2 php-pear-MDB2-Driver-mysqli bzip2 Create directory mkdir -p /var/www/html/nextcloud Get NextCloud wget https://download.nextcloud.com/server/releases/nextcloud-10.0.1.tar.bz2 Extract NextCloud tar xvf nextcloud-10.0.1.tar.bz2 -C /var/www/html Create directories not created by extract mkdir -p /var/www/html/nextcloud/data mkdir -p /var/www/html/nextcloud/etc mkdir -p /var/www/html/nextcloud/assets wget -O /etc/httpd/conf.d/nextcloud.conf https://raw.githubusercontent.com/nextcloud/server-packages/master/centos/nextcloud.conf default everything to root:apache chown -R root:apache /var/www/html/nextcloud/. set default directory and file permissions find /var/www/html/nextcloud -type d -exec chmod 0750 {} \; find /var/www/html/nextcloud -type f -exec chmod 0640 {} \; relax restrictions for selected folders and files that need more access chmod 0755 /var/www/html/nextcloud change ownership of folders and files
-
getting back to this setup now.
I would assume that the way the %attr works based on reading it is that all files in the listed folder get the listed permissions.