-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·26 lines (24 loc) · 892 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·26 lines (24 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
## Create ssh host keys
ssh-keygen -A
## Create guest user.
echo "## Creating Guest User"
GUEST="guest${RANDOM:0:3}"
PASSWD="$(dd if=/dev/urandom bs=1 count=10 2>/dev/null | base64 | sed 's/=*$//g')"
echo "## Login: $GUEST"
echo "## Password: $PASSWD (you can't use this though)"
adduser -D $GUEST
echo "$GUEST:$PASSWD" | chpasswd 2>&1 | sed 's|^|## |g'
mkdir /home/$GUEST/.ssh
cd /home/$GUEST/.ssh
ssh-keygen -t rsa -b 1024 -f ./id_rsa -N "" -q
ln -v id_rsa.pub authorized_keys
echo "####################################################################"
echo "## Guest users private ssh key: ##"
echo "####################################################################"
cat id_rsa
echo "####################################################################"
find . -exec chmod og= {} \;
cd /
chown -R $GUEST: /home/$GUEST
exec dumb-init "$@"