Redo of user to fix bugs

This commit is contained in:
Devin Dice 2022-08-09 00:52:05 -04:00
parent ba8f9c8158
commit d8c3ceac00
5 changed files with 29 additions and 31 deletions

View file

@ -154,6 +154,7 @@ HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/ap
ENTRYPOINT ["/startup.sh"]
# Install Docker
RUN groupadd -g 281 docker
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
RUN echo \

View file

@ -167,9 +167,6 @@ See the LICENSE file for details.
## New
Failing to generate a key using the below path will cause the key to delete after a routine update to the cluster. After the upgrade, use the command above to generate a new key for it to be persistent
Generate percistent SSH key using otherwise it will delete on upgrade:
#ssh-keygen -t ed25519 -f /workspace/.$USER/.ssh/id_ed25519 -C "user@cloud9"
ENV Vars
USER
PASSWORD
@ -182,7 +179,4 @@ SHOW_MENU_ICONS
SHOW_TOOLTIPS
SHOW_GENERIC_NAMES
/workspace/.ubuntu/docker_creds
user
pass
set docker group id to the host group id

View file

@ -15,7 +15,7 @@ HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
export HISTFILE=/workspace/.bash_history
#export HISTFILE=$HOME/.bash_history
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

View file

@ -0,0 +1 @@
Do not save anything to this directory as it will routinely get cleared. Use your users home directory.

View file

@ -1,5 +1,4 @@
#!/bin/bash
if [ -n "$VNC_PASSWORD" ]; then
echo -n "$VNC_PASSWORD" > /.password1
x11vnc -storepasswd $(cat /.password1) /.password2
@ -32,7 +31,8 @@ USER=${USER:-root}
HOME=/root
if [ "$USER" != "root" ]; then
echo "* enable custom user: $USER"
useradd --create-home --shell /bin/bash --user-group --groups adm,sudo $USER
useradd --create-home --shell /bin/bash --user-group --groups adm,sudo,docker -d /workspace/.home/$USER $USER
if [ -z "$PASSWORD" ]; then
echo " set default password to \"ubuntu\""
PASSWORD=ubuntu
@ -41,7 +41,7 @@ if [ "$USER" != "root" ]; then
PASSWORD=$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)
fi
HOME=/home/$USER
HOME=/workspace/.home/$USER
echo "$USER:$PASSWORD" | chpasswd
cp -r /root/{.config,.gtkrc-2.0,.asoundrc} ${HOME}
chown -R $USER:$USER ${HOME}
@ -78,33 +78,33 @@ PASSWORD=
HTTP_PASSWORD=
# BashRC
cp /cloud9/bashrc.default /home/$USER/.bashrc
chown -R $USER:$USER /home/$USER/.bashrc
cp /cloud9/bashrc.default $HOME/.bashrc
chown -R $USER:$USER $HOME/.bashrc
# Gitconfig
touch /workspace/.ubuntu/gitconfig
ln -sf /workspace/.ubuntu/gitconfig /home/$USER/.gitconfig
#touch /workspace/.ubuntu/gitconfig
#ln -sf /workspace/.ubuntu/gitconfig /home/$USER/.gitconfig
# cloud9
cp /cloud9/bashrc.default /home/$USER/.bashrc
mkdir -p /workspace/.$USER/.standalone
mkdir -p /workspace/.$USER/.c9
USER_SETTINGS="/workspace/.$USER/user.settings"
if [ ! -f $USER_SETTINGS ]; then touch $USER_SETTINGS; fi
ln -sf $USER_SETTINGS /home/$USER/.c9/user.settings
#mkdir -p /workspace/.$USER/.standalone
#mkdir -p /workspace/.$USER/.c9
#USER_SETTINGS="/workspace/.$USER/user.settings"
#if [ ! -f $USER_SETTINGS ]; then touch $USER_SETTINGS; fi
#ln -sf $USER_SETTINGS /home/$USER/.c9/user.settings
# Symlink SSH keys
mkdir -p /workspace/.$USER/.ssh
chmod 700 /workspace/.$USER/.ssh
ln -sf /workspace/.$USER/.ssh /home/$USER/.ssh
#mkdir -p /workspace/.$USER/.ssh
#chmod 700 /workspace/.$USER/.ssh
#ln -sf /workspace/.$USER/.ssh /home/$USER/.ssh
if [ -n "$DOMAIN" ]; then
DOMAIN="cloud9.example.com"
fi
chown -R $USER:$USER /home/$USER /cloud9 /workspace
chown -R $USER:$USER $HOME /cloud9 /workspace
# Add required packages for ubuntu user (Run as user)
rm -rf $HOME/.c9
mkdir -p /workspace/.c9
chown $USER:$USER /workspace/.c9
sudo -H -u $USER bash -c 'bash /cloud9/user-install.sh' 2>&1> /workspace/.c9/install.log &
@ -184,11 +184,13 @@ until [[ $SUCCESS == "TRUE" ]]; do
sleep 1
done &
DOCKER_CREDS=/workspace/.ubuntu/docker_creds
if test -f "$DOCKER_CREDS"; then
echo "DOCKER_CREDS exists."
#su $USER -c "DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo \$DOCKER_PASS | docker login --username \$DOCKER_USER --password-stdin)"
DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin
fi
#DOCKER_CREDS=/workspace/.ubuntu/docker_creds
#if test -f "$DOCKER_CREDS"; then
# echo "DOCKER_CREDS exists."
# #su $USER -c "DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo \$DOCKER_PASS | docker login --username \$DOCKER_USER --password-stdin)"
# DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin
#fi
chown root:root /home
exec /bin/tini -- supervisord -n -c /etc/supervisor/supervisord.conf