#!/bin/sh set -eu # ------------------------------------------------------------ # Configuration # ------------------------------------------------------------ HOST_PROJECT_PATH="${HOST_PROJECT_PATH:-}" SSH_ROLE="${SSH_ROLE:-}" SSH_PORT="${SSH_PORT:-22}" if [ -z "$HOST_PROJECT_PATH" ]; then echo "ERROR: HOST_PROJECT_PATH is not set." >&2 exit 1 fi if [ -z "$SSH_ROLE" ]; then echo "ERROR: SSH_ROLE is not set." >&2 exit 1 fi case "$SSH_ROLE" in main) EXPECTED_PORT="22" ;; companion) EXPECTED_PORT="2222" ;; *) echo "ERROR: unknown SSH_ROLE: $SSH_ROLE" >&2 echo "Expected: main or companion" >&2 exit 1 ;; esac # ------------------------------------------------------------ # SSH authorized keys # ------------------------------------------------------------ cp /project/ssh/authorized_keys /home/operator/.ssh/authorized_keys chown -R operator:operator /home/operator/.ssh chmod 700 /home/operator/.ssh chmod 600 /home/operator/.ssh/authorized_keys # ------------------------------------------------------------ # Interactive shell environment # ------------------------------------------------------------ cat > /etc/profile.d/gpu-node.sh <