#!/bin/bash machinename="$1" username="$2" machineusername=contestant userline=$(grep "^$username;" contestants.csv) if [ $? -ne 0 ]; then echo "User $username not found" exit 1 fi fullname=$(echo "$userline" | cut "-d;" -f2) # Set real name of machine user ssh -F local.ssh_config "$machinename" chfn --full-name "\"$fullname\"" $machineusername # Install client certificate scp -F local.ssh_config "certs/$username.p12" "$machinename:/home/$machineusername/clientcert.p12" ssh -F local.ssh_config "$machinename" install-client-cert $machineusername