Skip to content

Commit c64ea4f

Browse files
karelyatinosfrickler
authored andcommitted
Fix doc and user create script to set homedir permissions
RHEL based distros set homedir permissions to 700, and Ubuntu 21.04+ to 750[1], i.e missing executable permission for group or others, this results into failures as defined in the below bug. Since in doc we add useradd command, it's good to add instructions to fix the permissions there itself instead of getting failures during installation and then fixing it. Also update user create script to fix permissions by adding executable bit to DEST directory if missing. [1] https://discourse.ubuntu.com/t/private-home-directories-for-ubuntu-21-04-onwards/19533 Closes-Bug: #1966858 Change-Id: Id2787886433281238eb95ee11a75eddeef514293
1 parent d380858 commit c64ea4f

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

doc/source/guides/multinode-lab.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ Otherwise create the stack user:
7575

7676
useradd -s /bin/bash -d /opt/stack -m stack
7777

78+
Ensure home directory for the ``stack`` user has executable permission for all,
79+
as RHEL based distros create it with ``700`` and Ubuntu 21.04+ with ``750``
80+
which can cause issues during deployment.
81+
82+
::
83+
84+
chmod +x /opt/stack
85+
7886
This user will be making many changes to your system during installation
7987
and operation so it needs to have sudo privileges to root without a
8088
password:

doc/source/guides/single-machine.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ below)
4949
5050
$ sudo useradd -s /bin/bash -d /opt/stack -m stack
5151
52+
Ensure home directory for the ``stack`` user has executable permission for all,
53+
as RHEL based distros create it with ``700`` and Ubuntu 21.04+ with ``750``
54+
which can cause issues during deployment.
55+
56+
.. code-block:: console
57+
58+
$ sudo chmod +x /opt/stack
59+
5260
Since this user will be making many changes to your system, it will need
5361
to have sudo privileges:
5462

doc/source/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ to run DevStack with
5757
5858
$ sudo useradd -s /bin/bash -d /opt/stack -m stack
5959
60+
Ensure home directory for the ``stack`` user has executable permission for all,
61+
as RHEL based distros create it with ``700`` and Ubuntu 21.04+ with ``750``
62+
which can cause issues during deployment.
63+
64+
.. code-block:: console
65+
66+
$ sudo chmod +x /opt/stack
67+
6068
Since this user will be making many changes to your system, it should
6169
have sudo privileges:
6270

tools/create-stack-user.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ fi
4444
if ! getent passwd $STACK_USER >/dev/null; then
4545
echo "Creating a user called $STACK_USER"
4646
useradd -g $STACK_USER -s /bin/bash -d $DEST -m $STACK_USER
47+
# RHEL based distros create home dir with 700 permissions,
48+
# And Ubuntu 21.04+ with 750, i.e missing executable
49+
# permission for either group or others
50+
# Devstack deploy will have issues with this, fix it by
51+
# adding executable permission
52+
if [[ $(stat -c '%A' $DEST|grep -o x|wc -l) -lt 3 ]]; then
53+
echo "Executable permission missing for $DEST, adding it"
54+
chmod +x $DEST
55+
fi
4756
fi
4857

4958
echo "Giving stack user passwordless sudo privileges"

0 commit comments

Comments
 (0)