summaryrefslogtreecommitdiff
path: root/docker/tripleoclient/create_super_user.sh
blob: 37c8bf1df1efdb524e78a3d56d075ed9a632d8aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
# This is a useful entrypoint/cmd if you wish to run commands in a container
# in an existing users $HOME directory
# For example: docker run -ti -e USER=stack -e UID=1000 --privileged=true --volume=/home/stack/:/home/stack/ tripleoclient:latest /usr/local/bin/create_super_user.sh

if [ -n "$USER" -a -n "$UID" ]; then
    useradd "$USER" -u "$UID" -M
cat >> /etc/sudoers <<EOF_CAT
$USER ALL=(ALL) NOPASSWD:ALL
EOF_CAT
    su -l $USER
    export TERM="xterm"
    alias ls='ls --color=auto'
    /bin/bash
else
    echo "Please set valid $USER and $UID env variables."
    exit 1
fi