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 ownership element 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 option child-element provides a means to pass an option to the chown command.

[Note] Note

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

The name child-element contains the name of the file (or directory) whose ownership is to be changed. This child-element can accept both names and group numbers.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The user attribute specifies the name of the user which will own the file or directory. This child-element can accept both names and user numbers. See Element: <user>.

The group attribute 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 to root
chgrp -R root /etc/rc.d

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

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

echo Changing owner of /etc/sysconfig to 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 to 0
chgrp -R 0 /etc/rc.d

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

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

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