21 lines
513 B
Bash
Executable File
21 lines
513 B
Bash
Executable File
#!/bin/bash
|
|
|
|
machinename="$1"
|
|
username="$2"
|
|
|
|
machineusername=contestant
|
|
|
|
userline=$(grep "^$username;" usernames.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 root@"$machinename" chfn --full-name "\"$fullname\"" $machineusername
|
|
|
|
# Install client certificate
|
|
scp "certs/$username.p12" "root@$machinename:/home/$machineusername/clientcert.p12"
|
|
ssh root@"$machinename" install-client-cert $machineusername
|