infra/codestorage/hg-ssh

Paddy 2015-10-15 Parent:121585c71fd7

6:4c6afe37e83a Go to Latest

infra/codestorage/hg-ssh/create_user.sh

Pull hostkeys when pulling SSH keys. Rather than relying on Kubernetes secrets and baking public keys right in, which was bound to get fraught, we now have some graceful degradation. It defaults to automatically-generated random keys, but will try to download some keys from Google Cloud Storage for the host. If it can find some, it'll try to use those, instead.

History
1 #!/bin/bash
3 USERNAME=$1
4 IDS=$2
6 adduser --disabled-password --gecos "" -u $IDS $USERNAME
7 mkdir -p /home/$USERNAME/.ssh && touch /home/$USERNAME/.ssh/authorized_keys
8 chmod 0700 /home/$USERNAME/.ssh && chmod 0600 /home/$USERNAME/.ssh/authorized_keys
9 chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh
10 usermod -g 2000 $USERNAME
12 ln -s /mounted/repos /home/$USERNAME/repos