What if ran as root?
This commit is contained in:
parent
c35290ae2d
commit
33f5012583
2
Makefile
2
Makefile
|
@ -12,7 +12,7 @@ run: cloner
|
|||
docker run -v $(GLOBALVOL):/data -it --rm $(TAGBASE)
|
||||
|
||||
run-once: cloner
|
||||
docker run -v $(GLOBALVOL):/data -it --rm --user=executor $(TAGBASE) /usr/local/bin/cron-command
|
||||
docker run -v $(GLOBALVOL):/data -it --rm $(TAGBASE) /usr/local/bin/cron-command
|
||||
|
||||
run-bash: cloner
|
||||
docker run -v $(GLOBALVOL):/data -it --rm $(TAGBASE) /bin/bash
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# if started as root
|
||||
if [ $UID -eq 0 ]
|
||||
then
|
||||
find /data \! -user executor -exec chown executor:executor {} \;
|
||||
su executor -c cron-command
|
||||
exit $?
|
||||
fi
|
||||
# check lock
|
||||
lock=/var/run/cloner.pid
|
||||
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# if started as root
|
||||
if [ $UID -eq 0 ]
|
||||
then
|
||||
chown executor:executor /data
|
||||
su executor -c wizzard
|
||||
exit $?
|
||||
fi
|
||||
|
||||
dir_prefix=cloner
|
||||
|
||||
function die(){
|
||||
|
@ -88,7 +96,7 @@ function reuseSSHKey(){
|
|||
sed -e 's/#.*$//' $scratch > $keyfile
|
||||
rm $scratch
|
||||
echo "Checking key..."
|
||||
chmod 0600 $keyfile
|
||||
chmod 0700 $keyfile
|
||||
ssh-keygen -y -f $keyfile -P "" || true # will fail in the end, so script will continue and clean up the mess
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user