Element: <ownership>

Syntax

<!ELEMENT ownership      (option?, name+)>
<!ATTLIST ownership
          base           CDATA #IMPLIED
          user           CDATA #IMPLIED
          group          CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <option> | Element: <name>

Description

The element ownership is one of the top-level operation elements. It is used to perform a group and/or user ownership change on a file or set of files

The sub-element option provides a means to pass an option to the chown command.

[Note] Note

Not all of the chown options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

The sub-element name contains the name of the file (or directory) whose ownership is to be changed.

The attribute base specifies the directory in which the command is performed. See Element : <base>.

The attribute user specifies the name of the user which will own the file or directory. See Element: <user>.

The attribute group specifies the name of the group which will own the file or directory.

Example #1

The first example uses symbolic names.

<ownership user="root" group="root">
        <option>recursive</option>
        <name>/etc/rc.d</name>
        <name>/etc/sysconfig</name>
</ownership>

The equivalent bash script is :

echo Changing group of /etc/rc.d into root
chgrp -R root /etc/rc.d

echo Changing owner of /etc/rc.d into root
chown -R root /etc/rc.d

echo Changing group of /etc/sysconfig into root
chgrp -R root /etc/sysconfig

echo Changing owner of /etc/sysconfig into root
chown -R root /etc/sysconfig

Example #2

The second example uses numeric values (0 = root).

<ownership user="0" group="0">
        <option>recursive</option>
        <name>/etc/rc.d</name>
        <name>/etc/sysconfig</name>
</ownership>

The equivalent bash script is :

echo Changing group of /etc/rc.d into 0
chgrp -R 0 /etc/rc.d

echo Changing owner of /etc/rc.d into 0
chown -R 0 /etc/rc.d

echo Changing group of /etc/sysconfig into 0
chgrp -R 0 /etc/sysconfig

echo Changing owner of /etc/sysconfig into 0
chown -R 0 /etc/sysconfig