tripleo-image-elements/elements/stackuser/install.d/50-user
Ryan Brady 2b113e1e29 Fix dib-lint failures
As part of an ongoing effort to apply more testing against
elements, this patch provides fixes for most dib-lint
failures outside of the set -o pipefail patch[1] including
set options, indention, and file permissions.  There are
still a few indention errors left after this patch, but
they should be ignored in a dib-lint patch soon to add
additional exclusions.

[1] Ib97e3a35dd0ee653f1298c9ffe6ea99cea9dfd55

Change-Id: Ibf3dfc5735752900598466b0a54342692ef77284
2014-07-31 12:25:59 -04:00

29 lines
550 B
Bash
Executable File

#!/bin/bash
# Add the stack user we recommend folk use.
set -eu
set -o xtrace
useradd -m stack -s /bin/bash
passwd stack <<EOF
stack
stack
EOF
cat > /etc/sudoers.d/stack <<eof
# the stack user sometimes requires passwordless
# sudo for scripted operations.
stack ALL=(ALL) NOPASSWD:ALL
eof
chmod 0440 /etc/sudoers.d/stack
visudo -c
if [ -e "/tmp/in_target.d/ssh-authorized-keys" ]; then
mkdir -p /home/stack/.ssh
cat /tmp/in_target.d/ssh-authorized-keys >> /home/stack/.ssh/authorized_keys
chown -R stack:stack /home/stack/.ssh
fi