Last active
October 25, 2024 12:17
-
-
Save pizzapanther/e341fd980d8469724465018db657d529 to your computer and use it in GitHub Desktop.
Initialize scripts for your Docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user=`id -nu $1` | |
export HOME=`eval echo ~$user` | |
ln -s /app/.bash_history $HOME/.bash_history | |
ln -s /app/.python_history $HOME/.python_history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $(getent group $1) ]; then | |
echo "group $1 exists."; | |
else | |
echo "group $1 does not exist."; | |
addgroup worker --gid $groupid; | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if id "$1" >/dev/null 2>&1; then | |
echo "user found"; | |
user=`id -nu $1`; | |
else | |
echo "user not found"; | |
useradd -ms /bin/bash -u $1 -g $2 worker; | |
user=worker; | |
fi | |
echo "$user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment